示例#1
0
    public static InventoryManager.INVENTORY_TYPE GetInventoryType(EquipSetInfo setInfo, int index)
    {
        switch (index)
        {
        default:
        {
            EquipItemInfo equipItemInfo = setInfo.item[index];
            if (equipItemInfo != null)
            {
                int equipmentTypeIndex = UIBehaviour.GetEquipmentTypeIndex(equipItemInfo.tableData.type);
                return((InventoryManager.INVENTORY_TYPE)(equipmentTypeIndex + 1));
            }
            return(InventoryManager.INVENTORY_TYPE.ONE_HAND_SWORD);
        }

        case 3:
            return(InventoryManager.INVENTORY_TYPE.ARMOR);

        case 4:
            return(InventoryManager.INVENTORY_TYPE.HELM);

        case 5:
            return(InventoryManager.INVENTORY_TYPE.ARM);

        case 6:
            return(InventoryManager.INVENTORY_TYPE.LEG);
        }
    }
 public override void Initialize()
 {
     selectTypeIndex   = UIBehaviour.GetEquipmentTypeIndex((EQUIPMENT_TYPE)(int)GameSection.GetEventData());
     weaponPickupIndex = Array.FindIndex(uiTypeTab, (UI ui) => ui == UI.BTN_WEAPON_PICKUP);
     armorPickupIndex  = Array.FindIndex(uiTypeTab, (UI ui) => ui == UI.BTN_ARMOR_PICKUP);
     SetPrefab((Enum)UI.OBJ_ROOT, "SmithEquipSelectBase_" + prefabSuffix);
     base.Initialize();
 }
    protected void UpdateRoomUserInfo(Transform trans, int index)
    {
        SetActive(trans, UI.SPR_USER_EMPTY, false);
        SetActive(trans, UI.SPR_USER_BATTLE, false);
        SetActive(trans, UI.SPR_USER_READY, false);
        SetActive(trans, UI.SPR_USER_READY_WAIT, false);
        SetActive(trans, UI.OBJ_CHAT, false);
        QuestRoomUserInfo component = trans.GetComponent <QuestRoomUserInfo>();

        if (!(component == null))
        {
            userInfo = MonoBehaviourSingleton <StatusManager> .I.GetCreatePlayerInfo().charaInfo;

            if (userInfo == null)
            {
                component.LoadModel(index, null);
            }
            else
            {
                equipSetNo = MonoBehaviourSingleton <UserInfoManager> .I.userStatus.eSetNo;
                SetActive(trans, UI.SPR_WEAPON_1, false);
                SetActive(trans, UI.SPR_WEAPON_2, false);
                SetActive(trans, UI.SPR_WEAPON_3, false);
                int weapon_index = 0;
                userInfo.equipSet.ForEach(delegate(CharaInfo.EquipItem data)
                {
                    if (data != null)
                    {
                        EquipItemTable.EquipItemData equipItemData = Singleton <EquipItemTable> .I.GetEquipItemData((uint)data.eId);
                        if (equipItemData != null && equipItemData.IsWeapon())
                        {
                            SetActive(trans, weaponIcon[weapon_index], true);
                            int equipmentTypeIndex = UIBehaviour.GetEquipmentTypeIndex(equipItemData.type);
                            SetSprite(trans, weaponIcon[weapon_index], ITEM_TYPE_ICON_SPRITE_NAME[equipmentTypeIndex]);
                            weapon_index++;
                        }
                    }
                });
                component.LoadModel(index, userInfo);
                EquipSetCalculator equipSetCalculator = MonoBehaviourSingleton <StatusManager> .I.GetEquipSetCalculator(equipSetNo);

                SimpleStatus finalStatus = equipSetCalculator.GetFinalStatus(0, userInfo.hp, userInfo.atk, userInfo.def);
                SetLabelText(trans, UI.LBL_ATK, finalStatus.GetAttacksSum().ToString());
                SetLabelText(trans, UI.LBL_DEF, finalStatus.GetDefencesSum().ToString());
                SetLabelText(trans, UI.LBL_HP, finalStatus.hp.ToString());
                SetLabelText(trans, UI.LBL_NAME, userInfo.name);
                SetLabelText(trans, UI.LBL_LV, userInfo.level.ToString());
            }
        }
    }
    protected virtual void SetupInventoryTypeToggole()
    {
        bool flag = selectTypeIndex < UIBehaviour.GetEquipmentTypeIndex(EQUIPMENT_TYPE.ARMOR) || selectTypeIndex == weaponPickupIndex;

        SetActive((Enum)UI.OBJ_ATK_ROOT, flag);
        SetActive((Enum)UI.OBJ_DEF_ROOT, !flag);
        SetToggleButton((Enum)UI.TGL_BUTTON_ROOT, flag, (Action <bool>) delegate(bool is_active)
        {
            EQUIPMENT_TYPE type = (!is_active) ? EQUIPMENT_TYPE.HELM : EQUIPMENT_TYPE.ONE_HAND_SWORD;
            int num             = (!is_active) ? 1 : 0;
            ResetTween((Enum)tabAnimTarget[num], 0);
            PlayTween((Enum)tabAnimTarget[num], true, (EventDelegate.Callback)null, false, 0);
            SetActive((Enum)UI.OBJ_ATK_ROOT, is_active);
            SetActive((Enum)UI.OBJ_DEF_ROOT, !is_active);
            selectTypeIndex         = UIBehaviour.GetEquipmentTypeIndex(type);
            sortSettings.dialogType = ((!is_active) ? SortBase.DIALOG_TYPE.ARMOR : SortBase.DIALOG_TYPE.WEAPON);
            SortBase.SORT_REQUIREMENT sORT_REQUIREMENT = (sortSettings.dialogType != SortBase.DIALOG_TYPE.ARMOR) ? SortBase.SORT_REQUIREMENT.REQUIREMENT_WEAPON_BIT : SortBase.SORT_REQUIREMENT.REQUIREMENT_ARMORS_BIT;
            if ((sortSettings.requirement & sORT_REQUIREMENT) == (SortBase.SORT_REQUIREMENT) 0)
            {
                if (sortSettings.requirement == SortBase.SORT_REQUIREMENT.ATK)
                {
                    sortSettings.requirement = SortBase.SORT_REQUIREMENT.DEF;
                }
                else if (sortSettings.requirement == SortBase.SORT_REQUIREMENT.DEF)
                {
                    sortSettings.requirement = SortBase.SORT_REQUIREMENT.ATK;
                }
                else if (sortSettings.requirement == SortBase.SORT_REQUIREMENT.ELEM_ATK)
                {
                    sortSettings.requirement = SortBase.SORT_REQUIREMENT.ELEM_DEF;
                }
                else if (sortSettings.requirement == SortBase.SORT_REQUIREMENT.ELEM_DEF)
                {
                    sortSettings.requirement = SortBase.SORT_REQUIREMENT.ELEM_ATK;
                }
                else
                {
                    sortSettings.requirement = SortBase.SORT_REQUIREMENT.ELEMENT;
                }
            }
            SetDirty(InventoryUI);
            InitLocalInventory();
            LocalInventory();
            UpdateTabButton();
        });
    }
示例#5
0
        public int GetBadgeNum(EQUIPMENT_TYPE type)
        {
            int num = 0;
            int equipmentTypeIndex = UIBehaviour.GetEquipmentTypeIndex(type);

            if (!Singleton <EquipItemTable> .I.IsWeapon(type))
            {
                if (!Singleton <EquipItemTable> .I.IsVisual(type))
                {
                    equipmentTypeIndex -= 5;
                    return(defenseBadgeNum[equipmentTypeIndex]);
                }
                equipmentTypeIndex -= 5;
                return(visualBadgeNum[equipmentTypeIndex]);
            }
            return(weaponsBadgeNum[equipmentTypeIndex]);
        }
    public override void Initialize()
    {
        EQUIPMENT_TYPE eQUIPMENT_TYPE = (EQUIPMENT_TYPE)(int)GameSection.GetEventData();

        SmithManager.SmithCreateData smithCreateData = MonoBehaviourSingleton <SmithManager> .I.CreateSmithData <SmithManager.SmithCreateData>();

        smithCreateData.selectCreateEquipItemType = TranslateInventoryType(UIBehaviour.GetEquipmentTypeIndex(eQUIPMENT_TYPE));
        smithType = SmithType.GENERATE;
        GameSection.SetEventData(eQUIPMENT_TYPE);
        base.Initialize();
        pickupWeapon = Singleton <CreatePickupItemTable> .I.GetPickupItemAry(SortBase.TYPE.WEAPON_ALL);

        pickupArmor = Singleton <CreatePickupItemTable> .I.GetPickupItemAry(SortBase.TYPE.ARMOR_ALL);

        SetActive((Enum)UI.BTN_WEAPON_PICKUP, pickupWeapon.Length > 0);
        SetActive((Enum)UI.BTN_ARMOR_PICKUP, pickupArmor.Length > 0);
        selectTypeIndex = (int)Mathf.Log((float)smithCreateData.selectCreateEquipItemType, 2f);
        string caption = (!MonoBehaviourSingleton <InventoryManager> .I.IsWeaponInventoryType(base.selectInventoryType)) ? base.sectionData.GetText("CAPTION_DEFENCE") : base.sectionData.GetText("CAPTION_WEAPON");

        InitializeCaption(caption);
    }
示例#7
0
    protected void OnQuery_CHANGE()
    {
        if (localEquipSetData == null)
        {
            GameSection.StopEvent();
        }
        else
        {
            MonoBehaviourSingleton <StatusManager> .I.SetEquippingItem(localEquipSetData.equipSetInfo.item[localEquipSetData.index]);

            MonoBehaviourSingleton <InventoryManager> .I.changeInventoryType = StatusTop.GetInventoryType(localEquipSetData.equipSetInfo, localEquipSetData.index);
            if (!MonoBehaviourSingleton <UserInfoManager> .I.CheckTutorialBit(TUTORIAL_MENU_BIT.GACHA2))
            {
                List <EquipItemInfo> weaponInventory = MonoBehaviourSingleton <InventoryManager> .I.GetWeaponInventory();

                for (int i = 0; i < weaponInventory.Count; i++)
                {
                    if (weaponInventory[i].tableData.rarity >= RARITY_TYPE.S)
                    {
                        MonoBehaviourSingleton <InventoryManager> .I.changeInventoryType = (InventoryManager.INVENTORY_TYPE)(UIBehaviour.GetEquipmentTypeIndex(weaponInventory[i].tableData.type) + 1);
                        break;
                    }
                }
            }
            DetailEquipEventData detailEquipEventData = new DetailEquipEventData(gameEventData, localEquipSetData);
            GameSection.SetEventData(detailEquipEventData);
        }
    }
示例#8
0
 public void RemoveSmithBadge(EQUIPMENT_TYPE type, bool is_pickup)
 {
     if (Singleton <EquipItemTable> .I.IsWeapon(type))
     {
         int equipmentTypeIndex = UIBehaviour.GetEquipmentTypeIndex(type);
         if (is_pickup)
         {
             if (smithBadgeData.pickupBadgeIds[0] != null)
             {
                 GameSaveData.instance.AddCheckedSmithCreateRecipe(smithBadgeData.pickupBadgeIds[0].ToArray());
                 smithBadgeData.pickupBadgeIds[0].Clear();
             }
             smithBadgeData.pickupBadgeNum[0] = 0;
         }
         else
         {
             if (smithBadgeData.weaponsBadgeIds[equipmentTypeIndex] != null)
             {
                 GameSaveData.instance.AddCheckedSmithCreateRecipe(smithBadgeData.weaponsBadgeIds[equipmentTypeIndex].ToArray());
                 smithBadgeData.weaponsBadgeIds[equipmentTypeIndex].Clear();
             }
             smithBadgeData.weaponsBadgeNum[equipmentTypeIndex] = 0;
         }
     }
     else if (Singleton <EquipItemTable> .I.IsVisual(type))
     {
         int num = UIBehaviour.GetEquipmentTypeIndex(type) - 5;
         if (is_pickup)
         {
             if (smithBadgeData.pickupBadgeIds[1] != null)
             {
                 GameSaveData.instance.AddCheckedSmithCreateRecipe(smithBadgeData.pickupBadgeIds[1].ToArray());
                 smithBadgeData.pickupBadgeIds[1].Clear();
             }
             smithBadgeData.pickupBadgeNum[1] = 0;
         }
         else
         {
             if (smithBadgeData.visualBadgeIds[num] != null)
             {
                 GameSaveData.instance.AddCheckedSmithCreateRecipe(smithBadgeData.visualBadgeIds[num].ToArray());
                 smithBadgeData.visualBadgeIds[num].Clear();
             }
             smithBadgeData.visualBadgeNum[num] = 0;
         }
     }
     else
     {
         int num2 = UIBehaviour.GetEquipmentTypeIndex(type) - 5;
         if (is_pickup)
         {
             if (smithBadgeData.pickupBadgeIds[1] != null)
             {
                 GameSaveData.instance.AddCheckedSmithCreateRecipe(smithBadgeData.pickupBadgeIds[1].ToArray());
                 smithBadgeData.pickupBadgeIds[1].Clear();
             }
             smithBadgeData.pickupBadgeNum[1] = 0;
         }
         else
         {
             if (smithBadgeData.defenseBadgeIds[num2] != null)
             {
                 GameSaveData.instance.AddCheckedSmithCreateRecipe(smithBadgeData.defenseBadgeIds[num2].ToArray());
                 smithBadgeData.defenseBadgeIds[num2].Clear();
             }
             smithBadgeData.defenseBadgeNum[num2] = 0;
         }
     }
     GameSaveData.Save();
 }
示例#9
0
    private void CheckAndAddSmithBadge(SmithCreateItemInfo create_info, bool is_pickup = false)
    {
        int id = (int)create_info.equipTableData.id;

        if (NeedSmithBadge(create_info, is_pickup))
        {
            if (create_info.equipTableData.IsWeapon())
            {
                int equipmentTypeIndex = UIBehaviour.GetEquipmentTypeIndex(create_info.equipTableData.type);
                if (is_pickup)
                {
                    if (smithBadgeData.pickupBadgeIds[0] == null)
                    {
                        smithBadgeData.pickupBadgeIds[0] = new List <int>();
                    }
                    smithBadgeData.pickupBadgeIds[0].Add(id);
                    smithBadgeData.pickupBadgeNum[0]++;
                }
                else
                {
                    if (smithBadgeData.weaponsBadgeIds[equipmentTypeIndex] == null)
                    {
                        smithBadgeData.weaponsBadgeIds[equipmentTypeIndex] = new List <int>();
                    }
                    smithBadgeData.weaponsBadgeIds[equipmentTypeIndex].Add(id);
                    smithBadgeData.weaponsBadgeNum[equipmentTypeIndex]++;
                }
            }
            else if (create_info.equipTableData.IsVisual())
            {
                int num = UIBehaviour.GetEquipmentTypeIndex(create_info.equipTableData.type) - 5;
                if (is_pickup)
                {
                    if (smithBadgeData.pickupBadgeIds[1] == null)
                    {
                        smithBadgeData.pickupBadgeIds[1] = new List <int>();
                    }
                    smithBadgeData.pickupBadgeIds[1].Add(id);
                    smithBadgeData.pickupBadgeNum[1]++;
                }
                else
                {
                    if (smithBadgeData.visualBadgeIds[num] == null)
                    {
                        smithBadgeData.visualBadgeIds[num] = new List <int>();
                    }
                    smithBadgeData.visualBadgeIds[num].Add(id);
                    smithBadgeData.visualBadgeNum[num]++;
                }
            }
            else
            {
                int num2 = UIBehaviour.GetEquipmentTypeIndex(create_info.equipTableData.type) - 5;
                if (is_pickup)
                {
                    if (smithBadgeData.pickupBadgeIds[1] == null)
                    {
                        smithBadgeData.pickupBadgeIds[1] = new List <int>();
                    }
                    smithBadgeData.pickupBadgeIds[1].Add(id);
                    smithBadgeData.pickupBadgeNum[1]++;
                }
                else
                {
                    if (smithBadgeData.defenseBadgeIds[num2] == null)
                    {
                        smithBadgeData.defenseBadgeIds[num2] = new List <int>();
                    }
                    smithBadgeData.defenseBadgeIds[num2].Add(id);
                    smithBadgeData.defenseBadgeNum[num2]++;
                }
            }
        }
    }