Example #1
0
    protected override void OnInitializationUI()
    {
        GuiExtendDialog dlg = GetComponent <GuiExtendDialog>();

        if (dlg != null)
        {
            dlg.callbackFuntion   += OnDialogReback;
            dlg.buttonSelectStatus = (GuiExtendDialog.DialogFlag)IGamerProfile.gameBaseDefine.platformChargeIntensityData.closeLevel_LoginAward_BtnIndex;
        }
        payMoney.Text = IGamerProfile.gameBaseDefine.gameParameter.loginAward.paymoney.ToString();
        for (int i = 0; i < skillCount.Length; i++)
        {
            skillCount[i].Text = IGamerProfile.gameBaseDefine.gameParameter.loginAward.skill[i].ToString();
        }

        awardIcon      = new GameObject[IGamerProfile.gameBaseDefine.gameParameter.loginAward.equip.Length];
        equipIndexList = new int[awardIcon.Length];
        for (int i = 0; i < awardIcon.Length; i++)
        {
            int equipIndex = FTLibrary.Command.FTRandom.Next(GameEquip.EquipMaxCount);
            equipIndexList[i] = equipIndex;
            awardIcon[i]      = LoadResource_UIPrefabs(string.Format("equip{0}icon.prefab", equipIndex + 1));
            GuiPlaneAnimationText num = awardIcon[i].GetComponentInChildren <GuiPlaneAnimationText>();
            num.Text = IGamerProfile.gameBaseDefine.gameParameter.loginAward.equip[i].ToString();
            awardIcon[i].transform.localPosition = equipposition[i].transform.localPosition;
        }
    }
    private void OnPlayOpenBoxEffectEnd(int index)
    {
        if (awardIcon[index] != null)
        {
            UnityEngine.Object.DestroyObject(awardIcon[index]);
            awardIcon[index] = null;
        }
        GameBaseDefine.GameParameter.Treasure.AwardValueData awardData = IGamerProfile.gameBaseDefine.gameParameter.treasure.RandomAwardValueData();
        switch (awardData.type)
        {
        case GameBaseDefine.GameParameter.Treasure.AwardType.AwardType_Buttle:
        {
            awardIcon[index] = LoadResource_UIPrefabs("buttleicon.prefab");
            GuiPlaneAnimationText num = awardIcon[index].GetComponentInChildren <GuiPlaneAnimationText>();
            num.Text = awardData.value.ToString();
            awardIcon[index].transform.localPosition = boxposition[index].transform.localPosition;
            //awardIcon[index].transform.localScale = boxposition[index].transform.localScale;
            //修改档案
            //IGamerProfile.Instance.playerdata.playerButtle += awardData.value;
            IGamerProfile.Instance.SaveGamerProfileToServer();

            UiSceneGameMain uiMain = this.transform.parent.GetComponent <UiSceneGameMain>();
            //uiMain.playerButtle.SetIntegerRollValue(IGamerProfile.Instance.playerdata.playerButtle);
        }
        break;

        case GameBaseDefine.GameParameter.Treasure.AwardType.AwardType_Money:
        {
            awardIcon[index] = LoadResource_UIPrefabs("moneyicon.prefab");
            GuiPlaneAnimationText num = awardIcon[index].GetComponentInChildren <GuiPlaneAnimationText>();
            num.Text = awardData.value.ToString();
            awardIcon[index].transform.localPosition = boxposition[index].transform.localPosition;
            //awardIcon[index].transform.localScale = boxposition[index].transform.localScale;
            //修改档案
            IGamerProfile.Instance.playerdata.playerMoney += awardData.value;
            IGamerProfile.Instance.SaveGamerProfileToServer();

            UiSceneGameMain uiMain = this.transform.parent.GetComponent <UiSceneGameMain>();
            uiMain.playerMoney.SetIntegerRollValue(IGamerProfile.Instance.playerdata.playerMoney);
        }
        break;

        case GameBaseDefine.GameParameter.Treasure.AwardType.AwardType_Equip:
        {
            int equipIndex = FTLibrary.Command.FTRandom.Next(GameEquip.EquipMaxCount);
            awardIcon[index] = LoadResource_UIPrefabs(string.Format("equip{0}icon.prefab", equipIndex + 1));
            GuiPlaneAnimationText num = awardIcon[index].GetComponentInChildren <GuiPlaneAnimationText>();
            num.Text = awardData.value.ToString();
            awardIcon[index].transform.localPosition = boxposition[index].transform.localPosition;
            //awardIcon[index].transform.localScale = boxposition[index].transform.localScale;
            //修改档案
            IGamerProfile.Instance.playerdata.equipCount[equipIndex] += awardData.value;
            IGamerProfile.Instance.SaveGamerProfileToServer();

            UiSceneGameMain uiMain = this.transform.parent.GetComponent <UiSceneGameMain>();
            uiMain.UpdateEquipCount();
        }
        break;
        }
        if (IsAllBoxOpen)
        {
            Invoke("GotoNext", 2.0f);
        }
    }