Exemplo n.º 1
0
        public void Initialize(DutyModel dutyModel)
        {
            mDutyModel              = dutyModel;
            mLabelTitle.text        = dutyModel.Title;
            mLabelDescription.text  = UserInterfaceAlbumManager.Utils.NormalizeDescription(24, 1, dutyModel.Description);
            mLabelFuelValue.text    = dutyModel.Fuel.ToString();
            mLabelSteelValue.text   = dutyModel.Steel.ToString();
            mLabelAmmoValue.text    = dutyModel.Ammo.ToString();
            mLabelBauxiteValue.text = dutyModel.Baux.ToString();
            int num = 0;

            enumMaterialCategory[] source = new enumMaterialCategory[4]
            {
                enumMaterialCategory.Build_Kit,
                enumMaterialCategory.Dev_Kit,
                enumMaterialCategory.Repair_Kit,
                enumMaterialCategory.Revamp_Kit
            };
            foreach (KeyValuePair <enumMaterialCategory, int> rewardMaterial in mDutyModel.RewardMaterials)
            {
                if (source.Contains(rewardMaterial.Key) && 0 < rewardMaterial.Value && num < mSprites_RewardMaterials.Length)
                {
                    mSprites_RewardMaterials[num].spriteName = $"item_{MaterialEnumToMasterId(rewardMaterial.Key)}";
                    num++;
                }
            }
            for (int i = num; i < mSprites_RewardMaterials.Length; i++)
            {
                mSprites_RewardMaterials[i].spriteName = "none";
            }
        }
Exemplo n.º 2
0
        private IEnumerator InitializeCoroutine(DutyModel dutyModel)
        {
            mLabelTitle.text        = dutyModel.Title;
            mLabelDescription.text  = UserInterfaceAlbumManager.Utils.NormalizeDescription(24, 1, dutyModel.Description);
            mLabelFuelValue.text    = dutyModel.Fuel.ToString();
            mLabelSteelValue.text   = dutyModel.Steel.ToString();
            mLabelAmmoValue.text    = dutyModel.Ammo.ToString();
            mLabelBauxiteValue.text = dutyModel.Baux.ToString();
            mDutyStartButton.SetOnPositiveSelectedCallBack(delegate
            {
                if (this.mDutyDetailActionCallBack != null)
                {
                    this.mDutyDetailActionCallBack(SelectType.Positive);
                }
            });
            mDutyStartButton.SetOnNegativeSelectedCallBack(delegate
            {
                if (this.mDutyDetailActionCallBack != null)
                {
                    this.mDutyDetailActionCallBack(SelectType.Negative);
                }
            });
            mDutyStartButton.SetOnSelectedCallBack(delegate
            {
                this.mKeyController = null;
            });
            int materialIconIndex = 0;

            enumMaterialCategory[] showRewards = new enumMaterialCategory[4]
            {
                enumMaterialCategory.Build_Kit,
                enumMaterialCategory.Dev_Kit,
                enumMaterialCategory.Repair_Kit,
                enumMaterialCategory.Revamp_Kit
            };
            foreach (KeyValuePair <enumMaterialCategory, int> material in mDutyModel.RewardMaterials)
            {
                if (showRewards.Contains(material.Key) && 0 < material.Value && materialIconIndex < mSprites_RewardMaterials.Length)
                {
                    mSprites_RewardMaterials[materialIconIndex].spriteName = $"item_{MaterialEnumToMasterId(material.Key)}";
                    materialIconIndex++;
                }
            }
            for (int index = materialIconIndex; index < mSprites_RewardMaterials.Length; index++)
            {
                mSprites_RewardMaterials[index].spriteName = "none";
            }
            yield return(null);
        }
Exemplo n.º 3
0
        private IEnumerator ReciveReward(IReward[] rewards)
        {
            SingletonMonoBehaviour <UIShortCutMenu> .Instance.IsInputEnable = false;
            mModalCamera.Show();
            foreach (IReward reward in rewards)
            {
                if (reward is IReward_Materials)
                {
                    enumMaterialCategory[] fourMaterialsFilter = new enumMaterialCategory[5]
                    {
                        enumMaterialCategory.Bauxite,
                        enumMaterialCategory.Bull,
                        enumMaterialCategory.Fuel,
                        enumMaterialCategory.Steel,
                        enumMaterialCategory.Bauxite
                    };
                    enumMaterialCategory[] kitMaterialsFilter = new enumMaterialCategory[5]
                    {
                        enumMaterialCategory.Build_Kit,
                        enumMaterialCategory.Dev_Kit,
                        enumMaterialCategory.Repair_Kit,
                        enumMaterialCategory.Revamp_Kit,
                        enumMaterialCategory.Bauxite
                    };
                    List <IReward_Material> fourMaterials = new List <IReward_Material>();
                    List <IReward_Material> kitMaterials  = new List <IReward_Material>();
                    IReward_Materials       materials     = (IReward_Materials)reward;
                    IReward_Material[]      rewards2      = materials.Rewards;
                    foreach (IReward_Material material in rewards2)
                    {
                        if (fourMaterialsFilter.Contains(material.Type))
                        {
                            fourMaterials.Add(material);
                        }
                        else if (kitMaterialsFilter.Contains(material.Type))
                        {
                            kitMaterials.Add(material);
                        }
                    }
                    if (0 < fourMaterials.Count)
                    {
                        yield return(StartCoroutine(OnReciveRewardMaterials(fourMaterials.ToArray())));
                    }
                    if (0 < kitMaterials.Count)
                    {
                        foreach (IReward_Material kitMat in kitMaterials)
                        {
                            yield return(StartCoroutine(OnReciveRewardMaterials(new IReward_Material[1]
                            {
                                kitMat
                            })));
                        }
                    }
                }
                else if (reward is IReward_Ship)
                {
                    yield return(StartCoroutine(OnReciveRewardShip((IReward_Ship)reward)));
                }
                else if (reward is Reward_Useitems)
                {
                    TrophyUtil.Unlock_AlbumSlotNum();
                    yield return(StartCoroutine(OnReciveRewardItems((Reward_Useitems)reward)));
                }
                else if (reward is Reward_Deck)
                {
                    yield return(StartCoroutine(OnReciveRewardDeck((Reward_Deck)reward)));
                }
                else if (reward is Reward_LargeBuild)
                {
                    yield return(StartCoroutine(OnReciveRewardLargeBuild((Reward_LargeBuild)reward)));
                }
                else if (reward is IReward_Exchange_Slotitem)
                {
                    yield return(StartCoroutine(OnReciveRewardExchangeSlotItem((IReward_Exchange_Slotitem)reward)));
                }
                else if (reward is Reward_Furniture)
                {
                    yield return(StartCoroutine(OnReciveRewardFurniture((Reward_Furniture)reward)));
                }
                else if (reward is Reward_SPoint)
                {
                    yield return(StartCoroutine(OnReciveSpoint((Reward_SPoint)reward)));
                }
                else if (reward is Reward_Useitem)
                {
                    TrophyUtil.Unlock_AlbumSlotNum();
                    yield return(StartCoroutine(OnReciveRewardItem((Reward_Useitem)reward)));
                }
                else if (reward is IReward_Slotitem)
                {
                    TrophyUtil.Unlock_AlbumSlotNum();
                    yield return(StartCoroutine(OnReciveRewardSlotItem((IReward_Slotitem)reward)));
                }
                else if (reward is Reward_DeckPracitce)
                {
                    yield return(StartCoroutine(OnReciveRewardOpenDeckPractice((Reward_DeckPracitce)reward)));
                }
                else if (reward is Reward_TransportCraft)
                {
                    yield return(StartCoroutine(OnReciveRewardTransportCraft((Reward_TransportCraft)reward)));
                }
            }
            SingletonMonoBehaviour <UIPortFrame> .Instance.UpdateHeaderInfo(mDutyManager);

            DutyModel[] duties = GetDuties();
            mDutyGrid.Initialize(duties);
            mDutyGrid.GoToPage(0);
            mModalCamera.Close();
            ChangeKeyController(mDutyGrid.GetKeyController());
            mDutyGrid.FirstFocus();
            if (duties.Length <= 0)
            {
                mTransform_AllClearText.SetActive(isActive: true);
            }
            SingletonMonoBehaviour <UIShortCutMenu> .Instance.IsInputEnable = true;
            UpdateOrderPossibleDutyCount(mDutyManager.MaxExecuteCount - mDutyManager.GetExecutedDutyList().Count, animate: true);
        }