//purchase 5 mana potions public bool Add5_ManaPotion() { bool boolResult = false; bool boolFlat = PlayerExtenalDataProxy.GetInstance().MinusGold(10); //you have subtract gold from player account and then add 5 mana potions if (boolFlat) { PlayerInventoryDataProxy.GetInstance().IncreaseManaPotion(5); boolResult = true; } else { boolResult = false; } return(boolResult); }
//increase dexterity public bool Add1_DexterityIncrease() { bool boolResult = false; bool boolFlat = PlayerExtenalDataProxy.GetInstance().MinusGold(10); //you have subtract gold from player account and then add dexterity increase if (boolFlat) { PlayerInventoryDataProxy.GetInstance().IncreaseDexItem(1); boolResult = true; } else { boolResult = false; } return(boolResult); }
//10 golds public bool Add10_Gold() { bool boolResult = false; bool boolFlat = PlayerExtenalDataProxy.GetInstance().MinusDiamond(1); //you have subtract 1 diamond from player account and then add 10 golds if (boolFlat) { PlayerExtenalDataProxy.GetInstance().AddGold(10); boolResult = true; } else { boolResult = false; } return(boolResult); }
// Start is called before the first frame update IEnumerator Start() { // PlayerSaveDataProxy playerSaveDataProxy = new PlayerSaveDataProxy(100, 100, 10, // 5, 45, 100, 100, 10, 5, 50, 0, 0, 0); // // PlayerExtenalDataProxy playerExtenalDataProxy = new PlayerExtenalDataProxy(0, 0, 0, 0, 0); yield return(new WaitForSeconds(WAIT_FOR_SECONDS_ON_START)); //Show initial value PlayerSaveDataProxy.GetInstance().DisplayAllOriginalValues(); PlayerExtenalDataProxy.GetInstance().DisplayerAllOriginalValue(); //player name // if((GlobalParaMgr.PlayerName != null) && (!GlobalParaMgr.PlayerName.Trim().Equals(""))) if (!string.IsNullOrEmpty(GlobalParaMgr.PlayerName)) { TxtPlayerName.text = GlobalParaMgr.PlayerName; TxtPlayerNameByDetailPanel.text = GlobalParaMgr.PlayerName; } }
public void AddGold(int goldValues) { PlayerExtenalDataProxy.GetInstance().AddGold(goldValues); }
public void AddKillnumber() { PlayerExtenalDataProxy.GetInstance().AddKillnumber(); }
public void Gold() { PlayerExtenalDataProxy.GetInstance().AddGold(100); }
/// <summary> /// get current diamonds /// </summary> /// <returns></returns> public int GetDiamonds() { return(PlayerExtenalDataProxy.GetInstance().GetDiamonds()); }
/// <summary> /// level up /// </summary> public void AddLevel() { PlayerExtenalDataProxy.GetInstance().AddLevel(); }
public void AddExp() { PlayerExtenalDataProxy.GetInstance().UpgradeConition(200); }
public void RemoveDiamods(int RemoveValues) { PlayerExtenalDataProxy.GetInstance().RemoveDiamods(RemoveValues); }
//10 diamonds public bool Add10_Diamonds() { //you have to connect to app store payment SDK. PlayerExtenalDataProxy.GetInstance().AddDiamond(10); return(true); }
public void IncreaseEXP() { //use modle layer functions PlayerExtenalDataProxy.GetInstance().AddEXP(100); }
public void Diamond() { PlayerExtenalDataProxy.GetInstance().AddDiamond(100); }
public void RemoveGold(int removeGoldValues) { PlayerExtenalDataProxy.GetInstance().RemoveGold(removeGoldValues); }
public void AddDiamods(int diamodsValues) { PlayerExtenalDataProxy.GetInstance().AddDiamods(diamodsValues); }
public void SetCurrentExp(int exp) { PlayerExtenalDataProxy.GetInstance().SetCurrentExp(exp); }
public void SetLevel(int level) { PlayerExtenalDataProxy.GetInstance().SetLevel(level); }
public void AddExp(int expValues) { PlayerExtenalDataProxy.GetInstance().AddExp(expValues); }
public int GetKillNumber() { return(PlayerExtenalDataProxy.GetInstance().GetKillNumber()); }
public void UpgradeConition(int expValues) { PlayerExtenalDataProxy.GetInstance().UpgradeConition(expValues); }
/// <summary> /// get current gold /// </summary> /// <returns></returns> public int GetGold() { return(PlayerExtenalDataProxy.GetInstance().GetGold()); }
public int GetLevelExp() { return(PlayerExtenalDataProxy.GetInstance().GetLevelExp()); }
/// <summary> /// 升级规则 /// </summary> /// <param name="exp">传入的经验</param> public void UpgradeConition(int exp) { int currentLevel = 0; //当前等级 int currentExp = 0; //当前经验 int levelNextUpExp = 0; //下一级提升等级所需的经验 int levelExp; //当前等级满级经验 int levelNextExp; //下一等级满级经验 int[] levelNextsUpExp = new int[_DicLevel.Count - currentLevel]; //存储剩下每级提升所需的经验 currentExp = PlayerExtenalDataProxy.GetInstance().GetExp() + exp; //当前经验 currentLevel = PlayerExtenalDataProxy.GetInstance().GetLevel(); //当前等级 _DicLevel.TryGetValue(currentLevel, out levelExp); _DicLevel.TryGetValue(currentLevel + 1, out levelNextExp); levelNextUpExp = levelNextExp - levelExp; //下一等级提升所需经验 if (currentExp >= levelExp) //当前获得经验大于该等级提升所需的经验 { int cumulativeExperience = 0; //经验累加 if (currentExp - Mathf.Abs(levelNextExp) >= levelNextUpExp) //如果多余的经验大于下一级升级所需的经验 { for (int i = 0; i < _DicLevel.Count - currentLevel; i++) //存储剩下每级提升所需的经验 { int currentLevelExp = 0; //当前等级所需的经验 int nextLevelExp = 0; //下一等级所需的经验 _DicLevel.TryGetValue(currentLevel + i, out currentLevelExp); _DicLevel.TryGetValue(currentLevel + i + 1, out nextLevelExp); levelNextsUpExp[i] = nextLevelExp - currentLevelExp; } for (int i = 0; i < levelNextsUpExp.Length; i++) { if (i == 0) { cumulativeExperience = levelNextsUpExp[i]; } else { cumulativeExperience += levelNextsUpExp[i] - levelNextsUpExp[i - 1]; //该等级加上上一个等级所需的经验 } if (currentExp - cumulativeExperience >= levelNextsUpExp[i]) //剩余的经验大于下一集升级所需的经验 { currentExp -= cumulativeExperience; PlayerExtenalDataProxy.GetInstance().AddLevel(); } } PlayerExtenalDataProxy.GetInstance().AddExp(exp); } else { PlayerExtenalDataProxy.GetInstance().AddLevel(); PlayerExtenalDataProxy.GetInstance().AddExp(exp); } } else { PlayerExtenalDataProxy.GetInstance().AddExp(exp); } }
public void Killnumbers() { PlayerExtenalDataProxy.GetInstance().AddKillNumber(100); }