static void InitCoinValue() { if (IGamerProfile.Instance != null) { UiSceneSelectGameCharacter.CharacterId id = UiSceneSelectGameCharacter.CharacterId.ShouYi; IGamerProfile.PlayerData.PlayerChacterData dt = IGamerProfile.Instance.playerdata.characterData[(int)id]; GameCharacter.CharacterData characterDt = IGamerProfile.gameCharacter.characterDataList[(int)id]; _CoinValue = characterDt.LevelAToVal.GetValue(dt.levelA); //单个金币代表的价值 } }
void ShowCoinData() { int coin = VirusGameDataAdapter.GetCurLevelCoin(); int jiaCheng = UnityEngine.Random.Range(10, 100); if (IGamerProfile.Instance != null) { UiSceneSelectGameCharacter.CharacterId id = UiSceneSelectGameCharacter.CharacterId.ShouYi; IGamerProfile.PlayerData.PlayerChacterData dt = IGamerProfile.Instance.playerdata.characterData[(int)id]; GameCharacter.CharacterData characterDt = IGamerProfile.gameCharacter.characterDataList[(int)id]; jiaCheng = characterDt.LevelBToVal.GetValue(dt.levelB); //关卡加成 } int jiaChengCoin = Mathf.CeilToInt(jiaCheng * coin / 100f); int totalCoin = coin + jiaChengCoin; _coinData.CoinText.text = VirusTool.GetStrByIntger(coin); _coinData.TotalCoinText.text = VirusTool.GetStrByIntger(totalCoin); _coinData.JiaChengText.text = jiaCheng.ToString() + "%:"; _coinData.JiaChengCoinText.text = VirusTool.GetStrByIntger(jiaChengCoin); }
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(); }
public UpgradeCharacterData(UiSceneSelectGameCharacter.CharacterId id, UiSceneSelectGameCharacter.CharacterAttribute att) { this.id = id; this.att = att; }