Ejemplo n.º 1
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);
    }
Ejemplo n.º 2
0
    private void SetupChipButtons()
    {
        GameObject original = Resources.Load <GameObject>("UICommon/Parts/Parts_Sphere_CHIP");

        this.chipSphereIconButtons = new ChipSphereIconButton[this.chipButtonsPositions.Length];
        DepthController component  = this.sphereRoot.GetComponent <DepthController>();
        int             depth      = this.sphereRoot.GetComponent <UIWidget>().depth;
        int             myGrowStep = CMD_ChipSphere.DataChg.monsterMG.growStep.ToInt32();
        int             arousal    = CMD_ChipSphere.DataChg.monsterM.GetArousal();

        this.myMaxChipSlot = 5;
        int num = 0;

        if (CMD_ChipSphere.DataChg.GetChipEquip().GetSlotStatus() == null)
        {
            global::Debug.LogError("DataChg.GetSlotStatus() == null");
        }
        else
        {
            GameWebAPI.RespDataCS_MonsterSlotInfoListLogic.Manage slotStatus = CMD_ChipSphere.DataChg.GetChipEquip().GetSlotStatus();
            global::Debug.LogFormat("無料:{0}/{1}, 課金:{2}/{3}", new object[]
            {
                slotStatus.slotNum,
                slotStatus.maxSlotNum,
                slotStatus.extraSlotNum,
                slotStatus.maxExtraSlotNum
            });
            num = slotStatus.extraSlotNum;
            this.myMaxChipSlot = slotStatus.maxSlotNum + slotStatus.maxExtraSlotNum;
            if (this.myMaxChipSlot != 5 && this.myMaxChipSlot != 10)
            {
                global::Debug.LogErrorFormat("スロット数がありえない. myMaxChipSlot:{0} [{1}, {2}]", new object[]
                {
                    this.myMaxChipSlot,
                    slotStatus.maxSlotNum,
                    slotStatus.maxExtraSlotNum
                });
                this.myMaxChipSlot = 10;
            }
        }
        for (int i = 0; i < this.myMaxChipSlot; i++)
        {
            Transform transform = UnityEngine.Object.Instantiate <GameObject>(original).transform;
            transform.name = string.Format("Parts_Sphere_CHIP_{0}", i + 1);
            ChipSphereIconButton component2 = transform.GetComponent <ChipSphereIconButton>();
            component.AddWidgetDepth(transform, depth);
            component2.cmdChipSphere = this;
            transform.SetParent(this.sphereRoot);
            transform.localScale    = Vector3.one;
            transform.localPosition = this.chipButtonsPositions[i];
            int num2 = i + 1;
            ChipSphereIconButton.Parameter parameter = this.CreateParameter(myGrowStep, arousal, num2);
            component2.SetupChip(parameter);
            component2.RefreshItemCountColor(this.extraPatchCount);
            component2.SetUnChoose();
            this.chipSphereIconButtons[i] = component2;
            if (num2 >= 6)
            {
                if (num >= 0)
                {
                    this.chipSphereIconButtons[num2 - 1].SetChipColor(true);
                }
                else
                {
                    this.chipSphereIconButtons[num2 - 1].SetChipColor(false);
                }
                num--;
            }
        }
        this.RefreshYellowLines();
        this.RefreshStatus();
        this.chipSphereIconButtons[0].OnTouch();
    }