コード例 #1
0
 public static string GetStringItemType(ItemDefinitionsType itemDefinitionsType, ItemEquipmentType itemEquipmentType)
 {
     if (itemDefinitionsType == ItemDefinitionsType.Equipment)
     {
         return(itemEquipmentType.ToString());
     }
     else
     {
         return(itemDefinitionsType.ToString());
     }
 }
コード例 #2
0
    public static ItemDefinitionsType CheckDefinitionsType(string type)
    {
        ItemDefinitionsType itemType = ItemDefinitionsType.Treasure;

        switch (type)
        {
        case INST_DefinitionType_TREASURE:
            itemType = ItemDefinitionsType.Treasure;
            break;

        case INST_DefinitionType_FOOD:
            itemType = ItemDefinitionsType.Food;
            break;

        case INST_DefinitionType_EQUIPMENT:
            itemType = ItemDefinitionsType.Equipment;
            break;
        }
        return(itemType);
    }
コード例 #3
0
ファイル: ItemsVM.cs プロジェクト: Theerapon/GDSG
    private ItemPickUp_Template CreateTemplate(string line)
    {
        string id                    = string.Empty;
        string itemName              = "New Item";
        string itemDescription       = "Item Desctioption";
        ItemDefinitionsType itemType = ItemDefinitionsType.Treasure;
        ItemEquipmentType   subType  = ItemEquipmentType.NONE;
        int purchasePrice            = 0;
        int sellingPrice             = 0;

        Sprite itemIcon = null;

        bool isEquipped     = false;
        bool isStorable     = false;
        bool isUseable      = false;
        bool isDestroyOnUse = false;
        bool isGiftable     = false;

        List <ItemPropertyAmount> itemProperties = new List <ItemPropertyAmount>();

        string[] entries = line.Split(',');
        for (int i = 0; i < entries.Length; i++)
        {
            string entry = entries[i];
            switch (entry)
            {
            case INST_SET_ItemID:
                id = entries[++i];
                break;

            case INST_SET_ItemName:
                itemName = (entries[++i]);
                break;

            case INST_SET_ItemDescription:
                itemDescription = (entries[++i]);
                break;

            case INST_SET_ItemDefinitionsType:
                itemType = ConvertType.CheckDefinitionsType((entries[++i]));
                break;

            case INST_SET_ItemEquipmentType:
                subType = ConvertType.CheckEquipmentType((entries[++i]));
                break;

            case INST_SET_PurchasePrice:
                purchasePrice = int.Parse(entries[++i]);
                break;

            case INST_SET_SellingPrice:
                sellingPrice = int.Parse(entries[++i]);
                break;

            case INST_SET_ItemIconPath:
                itemIcon = Resources.Load <Sprite>(entries[++i]);
                break;

            case INST_SET_IsEquipped:
                isEquipped = bool.Parse(entries[++i]);
                break;

            case INST_SET_IsStorable:
                isStorable = bool.Parse(entries[++i]);
                break;

            case INST_SET_IsUseable:
                isUseable = bool.Parse(entries[++i]);
                break;

            case INST_SET_IsDestroyOnUse:
                isDestroyOnUse = bool.Parse(entries[++i]);
                break;

            case INST_SET_IsGiftable:
                isGiftable = bool.Parse(entries[++i]);
                break;

            case INST_SET_ItemProperty:
                itemProperties.Add(new ItemPropertyAmount(ConvertType.CheckItemProperty(entries[++i]), float.Parse(entries[++i])));
                break;
            }
        }

        return(new ItemPickUp_Template(id, itemName, itemDescription, itemType, subType, purchasePrice, sellingPrice, itemIcon, isEquipped, isStorable, isUseable, isDestroyOnUse, isGiftable, itemProperties));
    }