public override void PickupMode(int ptrId)
{
//Picks up the clicked object in the view.
PlayerInventory pInv = this.GetComponent<PlayerInventory>();
if (InvMarker==null)
{
InvMarker=GameWorldController.instance.InventoryMarker;//InvMarker=GameObject.Find ("InventoryMarker");
}
if (pInv.ObjectInHand=="")//Player is not holding anything.
{//Find the object within the pickup range.
Ray ray ;
if (MouseLookEnabled==true)
{
ray =Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
}
else
{
ray= Camera.main.ScreenPointToRay(Input.mousePosition);
}
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray,out hit,GetPickupRange()))
{
ObjectInteraction objPicked;
objPicked=hit.transform.GetComponent<ObjectInteraction>();
if (objPicked!=null)//Only objects with ObjectInteraction can be picked.
{
if (objPicked.CanBePickedUp==true)
{
//check for weight
if (objPicked.GetWeight() > playerInventory.getEncumberance())
{//000~001~095~That is too heavy for you to pick up.
UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1,95));
return;
}
if (ptrId==-2)
{
//right click check for quant.
//Pickup if either not a quantity or is a quantity of one.
if ((objPicked.isQuant ==false) || ((objPicked.isQuant)&&(objPicked.Link==1)) || (objPicked.isEnchanted))
{
objPicked=Pickup(objPicked,pInv);
}
else
{
//Debug.Log("attempting to pick up a quantity");
UWHUD.instance.MessageScroll.Set ("Move how many?");
InputField inputctrl =UWHUD.instance.InputControl;//UWHUD.instance.MessageScroll.GetComponent<UIInput>();
inputctrl.gameObject.SetActive(true);
//inputctrl.GetComponent<GuiBase>().SetAnchorX(0.3f);
inputctrl.gameObject.GetComponent<InputHandler>().target=this.gameObject;
inputctrl.gameObject.GetComponent<InputHandler>().currentInputMode=InputHandler.InputCharacterQty;
//TODO: Fix me inputctrl.eventReceiver=this.gameObject;
//TODO: Fix me inputctrl.type=UIInput.KeyboardType.NumberPad;
inputctrl.text="1";
//TODO: Fix me inputctrl.label.text="1";
//TODO: Fix me inputctrl.selected=true;
inputctrl.Select();
QuantityObj=objPicked;
Time.timeScale=0.0f;
WindowDetect.WaitingForInput=true;
}
}
else
{//Left click. Pick them all up.
objPicked=Pickup(objPicked,pInv);
}
}
else
{//000~001~096~You cannot pick that up.
//Object cannot be picked up. Try and use it instead
if (objPicked.CanBeUsed)
{
UseMode();
UWHUD.instance.window.UWWindowWait (1.0f);
}
else
{
UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1,96));
}
}
}
}
}
}