Ejemplo n.º 1
0
    public void TargetPerformEquipAction(NetworkConnection conn, byte[] operationInfo)
    {
        NetworkReader      reader = new NetworkReader(operationInfo);
        EquipmentOperation op     = new EquipmentOperation(EquipmentOperation.Operation.SetHelmet, null);

        op.Deserialize(reader);
        PerformEquipAction(op);
    }
Ejemplo n.º 2
0
 public bool PerformEquipAction(EquipmentOperation op)
 {
     if (isLocalPlayer)
     {
         bool success = EquipmentOperation.PerformOperationWithBackpackUIUpdate(this, op, backpackUI);
         if (success)
         {
             equipUI.updateUI(info);
         }
         return(success);
     }
     else
     {
         return(EquipmentOperation.PerformOperation(this, op));
     }
 }
Ejemplo n.º 3
0
    public static bool PerformOperationWithBackpackUIUpdate(Player player, EquipmentOperation operation, BackpackInventoryUI invUI)
    {
        Item item = assertGoodItem(operation.itemData);

        if (item == null)
        {
            return(false);
        }

        switch (operation.op)
        {
        case Operation.SetHelmet:
            if (item is HelmetItem)
            {
                player.info.helmet = item as HelmetItem;
                return(true);
            }
            else
            {
                return(false);
            }

        case Operation.SetUpperBody:
            if (item is UpperBodyItem)
            {
                player.info.upperBody = item as UpperBodyItem;
                return(true);
            }
            else
            {
                return(false);
            }

        case Operation.SetLowerBody:
            if (item is LowerBodyItem)
            {
                player.info.lowerBody = item as LowerBodyItem;
                return(true);
            }
            else
            {
                return(false);
            }

        case Operation.SetBoots:
            if (item is BootsItem)
            {
                player.info.boots = item as BootsItem;
                return(true);
            }
            else
            {
                return(false);
            }

        case Operation.SetLeftClaw:
            if (item is ClawItem)
            {
                player.info.leftClaw = item as ClawItem;
                return(true);
            }
            else
            {
                return(false);
            }

        case Operation.SetRightClaw:
            if (item is ClawItem)
            {
                player.info.rightClaw = item as ClawItem;
                return(true);
            }
            else
            {
                return(false);
            }

        case Operation.SetBackpack:
            if (item is BackpackItem)
            {
                player.info.backpack = item as BackpackItem;
                if (invUI != null)
                {
                    invUI.loadInventory(player.info.backpack.inventory);
                }


                return(true);
            }
            else
            {
                return(false);
            }

        case Operation.SmartSet:
            return(smartEquip(item, player.info, invUI));

        default:
            Debug.Log("Unhandled EquipmentOperation case");
            return(false);
        }
    }
Ejemplo n.º 4
0
 public static bool PerformOperation(Player player, EquipmentOperation operation)
 {
     return(PerformOperationWithBackpackUIUpdate(player, operation, null));
 }