Пример #1
0
    private void Send(GameWebAPI.RespDataCS_ChipListLogic.UserChipList baseChip)
    {
        RestrictionInput.StartLoad(RestrictionInput.LoadType.SMALL_IMAGE_MASK_ON);
        int userChipId = baseChip.userChipId;

        GameWebAPI.RespDataMA_ChipM.Chip baseMaterChip = ChipDataMng.GetChipMainData(baseChip);
        int num = baseMaterChip.needChip.ToInt32();

        int[] array = null;
        if (num > 0)
        {
            array = new int[num];
            int num2 = 0;
            foreach (GameWebAPI.RespDataCS_ChipListLogic.UserChipList userChipList2 in ChipDataMng.userChipData.userChipList)
            {
                if (userChipId != userChipList2.userChipId && userChipList2.chipId == baseChip.chipId && userChipList2.userMonsterId == 0)
                {
                    array[num2] = userChipList2.userChipId;
                    num2++;
                    if (num2 >= array.Length)
                    {
                        break;
                    }
                }
            }
        }
        Action callback = delegate()
        {
            GameWebAPI.RespDataCS_ChipListLogic.UserChipList[] array2 = this.ConvertChipList(ChipDataMng.userChipData);
            this.chipList.ReAllBuild(array2, false, false);
            this.chipList.SetShortTouchCallback(new Action <GUIListChipParts.Data>(this.OnShortTouchChip));
            this.chipList.SetLongTouchCallback(new Action <GUIListChipParts.Data>(this.OnLongTouchChip));
            this.messageLabel.gameObject.SetActive(array2.Count <GameWebAPI.RespDataCS_ChipListLogic.UserChipList>() == 0);
            this.listCountLabel.text = string.Format(StringMaster.GetString("SystemFraction"), ChipDataMng.userChipData.userChipList.Length, DataMng.Instance().RespDataUS_PlayerInfo.playerInfo.chipLimitMax);
            GameWebAPI.RespDataMA_ChipM.Chip chipEnhancedData = ChipDataMng.GetChipEnhancedData(baseMaterChip.chipId);
            CMD_ChipReinforcementAnimation.Create(this.gameObject, chipEnhancedData, null);
        };
        int            resultCode = 0;
        APIRequestTask task       = ChipDataMng.RequestAPIChipFusion(baseChip.userChipId, array, delegate(int res)
        {
            resultCode = res;
        });

        AppCoroutine.Start(task.Run(delegate
        {
            if (resultCode == 1)
            {
                callback();
            }
            else
            {
                string @string = StringMaster.GetString("SystemDataMismatchTitle");
                string message = string.Format(StringMaster.GetString("ChipDataMismatchMesage"), resultCode);
                AlertManager.ShowModalMessage(delegate(int modal)
                {
                }, @string, message, AlertManager.ButtonActionType.Close, false);
            }
            RestrictionInput.EndLoad();
        }, null, null), false);
    }
Пример #2
0
    public void SetParam(GameWebAPI.RespDataCS_ChipListLogic.UserChipList data)
    {
        this.userChip = data;
        GameWebAPI.RespDataMA_ChipM.Chip prevMaterChip = ChipDataMng.GetChipMainData(this.userChip.chipId.ToString());
        this.prevReinforcementInfo.name.text        = prevMaterChip.name;
        this.prevReinforcementInfo.description.text = prevMaterChip.detail;
        this.prevReinforcementInfo.chipIcon.SetData(prevMaterChip, -1, -1);
        GameWebAPI.RespDataMA_ChipM.Chip chipEnhancedData = ChipDataMng.GetChipEnhancedData(this.userChip.chipId.ToString());
        this.nextReinforcementInfo.name.text        = chipEnhancedData.name;
        this.nextReinforcementInfo.description.text = chipEnhancedData.detail;
        this.nextReinforcementInfo.chipIcon.SetData(chipEnhancedData, -1, -1);
        int num = prevMaterChip.needChip.ToInt32();

        foreach (ChipIcon chipIcon in this.consumptionInfo.chipIcons)
        {
            chipIcon.SetActive(false);
        }
        for (int j = 0; j < num; j++)
        {
            this.consumptionInfo.chipIcons[j].SetActive(true);
            this.consumptionInfo.chipIcons[j].SetData(prevMaterChip, -1, -1);
        }
        GameWebAPI.RespDataCS_ChipListLogic userChipData = ChipDataMng.userChipData;
        int  num2 = userChipData.userChipList.Count((GameWebAPI.RespDataCS_ChipListLogic.UserChipList x) => this.userChip.userChipId != x.userChipId && x.chipId.ToString() == prevMaterChip.chipId && x.userMonsterId <= 0);
        bool flag = num2 >= num;

        if (flag)
        {
            this.consumptionInfo.message.text  = StringMaster.GetString("ChipReinforcementModal-05");
            this.consumptionInfo.message.color = ConstValue.DEFAULT_COLOR;
            this.EnableDecisionButton(true);
        }
        else
        {
            for (int k = 0; k < num; k++)
            {
                bool flag2 = k >= num2;
                this.consumptionInfo.chipIcons[k].SetSelectColor(flag2);
                this.consumptionInfo.chipIcons[k].SetSelectRankColor(flag2);
            }
            this.consumptionInfo.message.text  = StringMaster.GetString("ChipReinforcementModal-06");
            this.consumptionInfo.message.color = Color.red;
            this.EnableDecisionButton(false);
        }
    }
Пример #3
0
    private GameWebAPI.RespDataCS_ChipListLogic.UserChipList[] ConvertChipList(GameWebAPI.RespDataCS_ChipListLogic chipListLogic)
    {
        List <GameWebAPI.RespDataCS_ChipListLogic.UserChipList> list = new List <GameWebAPI.RespDataCS_ChipListLogic.UserChipList>();

        if (chipListLogic != null && chipListLogic.userChipList != null)
        {
            foreach (GameWebAPI.RespDataCS_ChipListLogic.UserChipList userChipList2 in chipListLogic.userChipList)
            {
                GameWebAPI.RespDataMA_ChipM.Chip chipEnhancedData = ChipDataMng.GetChipEnhancedData(userChipList2.chipId.ToString());
                if (chipEnhancedData != null)
                {
                    list.Add(userChipList2);
                }
            }
            CMD_ChipSortModal.UpdateSortedUserChipList(list.ToArray());
            return(CMD_ChipSortModal.sortedUserChipList);
        }
        return(list.ToArray());
    }
Пример #4
0
    public void SetupDetail(ChipSphereIconButton.Parameter parameter)
    {
        switch (parameter.menuType)
        {
        case CMD_ChipSphere.MenuType.Empty:
            NGUIUtil.ChangeUITextureFromFileASync(this.chipTexture, "ChipThumbnail/Chip_Empty", false, null);
            NGUITools.SetActiveSelf(this.chipTexture.gameObject, true);
            NGUITools.SetActiveSelf(this.chipNameLabel.gameObject, false);
            NGUITools.SetActiveSelf(this.rareSprite.gameObject, false);
            NGUITools.SetActiveSelf(this.chipLookTexture.gameObject, false);
            NGUITools.SetActiveSelf(this.lookGO, false);
            this.messageLabel.text       = StringMaster.GetString("ChipInstalling-03");
            this.buttonLabel.text        = StringMaster.GetString("ChipInstalling-04");
            this.chipNameLabel.color     = Color.white;
            this.myMenuType              = parameter.menuType;
            this.buttonSprite.spriteName = "Common02_Btn_Green";
            this.buttonCollider.enabled  = true;
            this.buttonLabel.color       = Color.white;
            this.buttonLabel.effectColor = this.defaultButtonLabelEffectColor;
            break;

        case CMD_ChipSphere.MenuType.Extendable:
        {
            NGUIUtil.ChangeUITextureFromFileASync(this.chipTexture, "ChipThumbnail/Chip_NotOpen", true, null);
            NGUITools.SetActiveSelf(this.lookGO, true);
            NGUITools.SetActiveSelf(this.rareSprite.gameObject, false);
            NGUITools.SetActiveSelf(this.chipNameLabel.gameObject, true);
            NGUITools.SetActiveSelf(this.chipLookTexture.gameObject, false);
            NGUITools.SetActiveSelf(this.chipTexture.gameObject, true);
            int itemCount = parameter.itemCount;
            this.chipNameLabel.text = string.Format("×{0}", itemCount);
            this.buttonLabel.text   = StringMaster.GetString("ChipInstalling-08");
            global::Debug.LogFormat("{0} >= {1}, isOpened:{2}", new object[]
                {
                    this.extendItemCount,
                    itemCount,
                    parameter.isOpened
                });
            bool flag = this.extendItemCount >= itemCount;
            if (flag)
            {
                this.chipNameLabel.color = Color.white;
            }
            else
            {
                this.chipNameLabel.color = Color.red;
            }
            if (flag && parameter.isExtendable)
            {
                this.messageLabel.text       = StringMaster.GetString("ChipInstalling-07");
                this.buttonSprite.spriteName = "Common02_Btn_Green";
                this.buttonCollider.enabled  = true;
                this.buttonLabel.color       = Color.white;
                this.buttonLabel.effectColor = this.defaultButtonLabelEffectColor;
            }
            else
            {
                this.messageLabel.text       = StringMaster.GetString("ChipInstalling-11");
                this.buttonSprite.spriteName = "Common02_Btn_Gray";
                this.buttonCollider.enabled  = false;
                this.buttonLabel.color       = ConstValue.DEACTIVE_BUTTON_LABEL;
                this.buttonLabel.effectColor = ConstValue.DEACTIVE_BUTTON_LABEL;
            }
            this.myMenuType = parameter.menuType;
            break;
        }

        case CMD_ChipSphere.MenuType.NotYet:
        {
            this.chipNameLabel.text = parameter.chipName;
            NGUITools.SetActiveSelf(this.rareSprite.gameObject, false);
            string text = string.Format(StringMaster.GetString("ChipInstalling-10"), parameter.chipDetail);
            this.messageLabel.text = text;
            break;
        }

        case CMD_ChipSphere.MenuType.Detail:
        {
            this.chipNameLabel.text = parameter.chipName;
            this.messageLabel.text  = parameter.chipDetail;
            NGUIUtil.ChangeUITextureFromFileASync(this.chipTexture, parameter.chipIconPath, false, null);
            NGUITools.SetActiveSelf(this.chipTexture.gameObject, true);
            this.rareSprite.spriteName = ChipTools.GetRankPath(parameter.chipRank);
            NGUITools.SetActiveSelf(this.rareSprite.gameObject, true);
            this.buttonSprite.spriteName = "Common02_Btn_Red";
            this.buttonCollider.enabled  = true;
            this.buttonLabel.color       = Color.white;
            this.buttonLabel.effectColor = this.defaultButtonLabelEffectColor;
            GameWebAPI.RespDataMA_ChipM.Chip chipEnhancedData = ChipDataMng.GetChipEnhancedData(parameter.ConvertChipId());
            if (chipEnhancedData != null)
            {
                if (this.reinforcementButtonSprite != null)
                {
                    this.reinforcementButtonSprite.spriteName = "Common02_Btn_Green";
                }
                if (this.reinforcementButtonCollider != null)
                {
                    this.reinforcementButtonCollider.enabled = true;
                }
                if (this.reinforcementButtonLabel != null)
                {
                    this.reinforcementButtonLabel.color = Color.white;
                }
                if (this.buttonLabel != null)
                {
                    this.buttonLabel.effectColor = this.defaultReinforcementButtonLabelEffectColor;
                }
            }
            else
            {
                if (this.reinforcementButtonSprite != null)
                {
                    this.reinforcementButtonSprite.spriteName = "Common02_Btn_Gray";
                }
                if (this.reinforcementButtonCollider != null)
                {
                    this.reinforcementButtonCollider.enabled = false;
                }
                if (this.reinforcementButtonLabel != null)
                {
                    this.reinforcementButtonLabel.color = ConstValue.DEACTIVE_BUTTON_LABEL;
                }
                if (this.buttonLabel != null)
                {
                    this.buttonLabel.effectColor = ConstValue.DEACTIVE_BUTTON_LABEL;
                }
            }
            break;
        }
        }
    }
Пример #5
0
    private void Send(GameWebAPI.RespDataCS_ChipListLogic.UserChipList baseChip)
    {
        this.SetBarrier(true);
        RestrictionInput.StartLoad(RestrictionInput.LoadType.SMALL_IMAGE_MASK_ON);
        int baseChipId = baseChip.userChipId;

        GameWebAPI.RespDataMA_ChipM.Chip baseMaterChip = ChipDataMng.GetChipMainData(baseChip);
        int num = baseMaterChip.needChip.ToInt32();

        int[] array = null;
        if (num > 0)
        {
            array = new int[num];
            int num2 = 0;
            foreach (GameWebAPI.RespDataCS_ChipListLogic.UserChipList userChipList2 in ChipDataMng.userChipData.userChipList)
            {
                if (baseChipId != userChipList2.userChipId && userChipList2.chipId == baseChip.chipId && userChipList2.userMonsterId == 0)
                {
                    array[num2] = userChipList2.userChipId;
                    num2++;
                    if (num2 >= array.Length)
                    {
                        break;
                    }
                }
            }
        }
        Action callback = delegate()
        {
            int num3 = this.selectedChipParameter.ConvertButtonIndex();
            ChipSphereIconButton             chipSphereIconButton = this.chipSphereIconButtons[num3];
            GameWebAPI.RespDataMA_ChipM.Chip chipEnhancedData     = ChipDataMng.GetChipEnhancedData(baseMaterChip.chipId);
            chipSphereIconButton.SetupDetail(this.selectedChipParameter.userChipId, chipEnhancedData);
            chipSphereIconButton.SetupOnlyDetailParams(baseChipId, chipEnhancedData);
            this.chipSphereIconButtons[num3].OnTouch();
            this.RefreshItemCountColor();
            this.RefreshStatus();
            this.RefreshItemNumbers();
            this.RefreshYellowLines();
            CMD_ChipReinforcementAnimation cmd_ChipReinforcementAnimation = CMD_ChipReinforcementAnimation.Create(this.gameObject, chipEnhancedData, delegate(int i)
            {
                this.SetBarrier(false);
            });
            cmd_ChipReinforcementAnimation.transform.Find("ChipLv/Chip").gameObject.AddComponent <AnimationFinishEventTrigger>();
        };
        int            resultCode = 0;
        APIRequestTask task       = ChipDataMng.RequestAPIChipFusion(baseChip.userChipId, array, delegate(int res)
        {
            resultCode = res;
        });

        AppCoroutine.Start(task.Run(delegate
        {
            if (resultCode == 1)
            {
                callback();
            }
            else
            {
                this.SetBarrier(false);
                this.DispErrorModal(resultCode);
            }
            RestrictionInput.EndLoad();
        }, null, null), false);
    }