Esempio n. 1
0
    private void OnButtonSelectOk(int index)
    {
        SoundEffectPlayer.Play("buttonok.wav");
        //获取最后解锁的地图
        int lastLockMapIndex = IGamerProfile.Instance.getLastLockedMap;

        if (lastLockMapIndex < currentSelectMapIndex)
        {
            SetCurrentSelectMapIndex(lastLockMapIndex);
            return;
        }

        //设置当前地图
        IGamerProfile.Instance.gameEviroment.mapIndex      = currentSelectMapIndex;
        IGamerProfile.Instance.gameEviroment.mapLevelIndex = IGamerProfile.Instance.playerdata.levelProcess[IGamerProfile.Instance.gameEviroment.mapIndex];
        if (IGamerProfile.Instance.gameEviroment.mapLevelIndex >= IGamerProfile.gameLevel.mapMaxLevel[IGamerProfile.Instance.gameEviroment.mapIndex])
        {
            IGamerProfile.Instance.gameEviroment.mapLevelIndex = IGamerProfile.gameLevel.mapMaxLevel[IGamerProfile.Instance.gameEviroment.mapIndex] - 1;
        }


        if ((GameCenterEviroment.platformChargeIntensity >= GameCenterEviroment.PlatformChargeIntensity.Intensity_VeryHigh) &&
            IGameCenterEviroment.effectCharacterLevelSale)
        {
            //优先升级副武器,其次升级主武器,最后升级收益属性
            int characterIndex = IGamerProfile.Instance.gameEviroment.characterIndex;
            UiSceneSelectGameCharacter.CharacterId        id  = (UiSceneSelectGameCharacter.CharacterId)characterIndex;
            UiSceneSelectGameCharacter.CharacterAttribute att = UiSceneSelectGameCharacter.GetUpgradeAttribute(id);
            //判断属性A是否需要升级
            bool isUpgrade = false;
            if (att != UiSceneSelectGameCharacter.CharacterAttribute.Null)
            {
                isUpgrade = UiSceneSelectGameCharacter.GetIsUpgradeCharacter(id, att);
            }

            if (isUpgrade == false)
            {
                //判断收益属性是否需要升级
                id  = UiSceneSelectGameCharacter.CharacterId.ShouYi;
                att = UiSceneSelectGameCharacter.GetUpgradeAttribute(id);
                if (att != UiSceneSelectGameCharacter.CharacterAttribute.Null)
                {
                    isUpgrade = UiSceneSelectGameCharacter.GetIsUpgradeCharacter(id, att);
                }
            }

            if (isUpgrade == true)
            {
                //需要升级
                //让本身停止工作
                buttonGroup.IsWorkDo = false;
                GameObject obj = LoadResource_UIPrefabs("characterlevelsale.prefab");
                UiSceneCharacterLevelSale com = obj.GetComponent <UiSceneCharacterLevelSale>();
                if (com != null)
                {
                    UpgradeCharacterData dt = new UpgradeCharacterData(id, att);
                    //Debug.Log("dt ==> " + dt.ToString());
                    com.Init(dt);
                }
                return;
            }
        }
        IntoGame();
    }
Esempio n. 2
0
 public UpgradeCharacterData(UiSceneSelectGameCharacter.CharacterId id, UiSceneSelectGameCharacter.CharacterAttribute att)
 {
     this.id  = id;
     this.att = att;
 }