Example #1
0
        //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);
        }
Example #2
0
        //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);
        }
Example #3
0
        //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;
            }
        }
Example #5
0
 public void AddGold(int goldValues)
 {
     PlayerExtenalDataProxy.GetInstance().AddGold(goldValues);
 }
Example #6
0
 public void AddKillnumber()
 {
     PlayerExtenalDataProxy.GetInstance().AddKillnumber();
 }
Example #7
0
 public void Gold()
 {
     PlayerExtenalDataProxy.GetInstance().AddGold(100);
 }
Example #8
0
 /// <summary>
 /// get current diamonds
 /// </summary>
 /// <returns></returns>
 public int GetDiamonds()
 {
     return(PlayerExtenalDataProxy.GetInstance().GetDiamonds());
 }
Example #9
0
 /// <summary>
 /// level up
 /// </summary>
 public void AddLevel()
 {
     PlayerExtenalDataProxy.GetInstance().AddLevel();
 }
 public void AddExp()
 {
     PlayerExtenalDataProxy.GetInstance().UpgradeConition(200);
 }
Example #11
0
 public void RemoveDiamods(int RemoveValues)
 {
     PlayerExtenalDataProxy.GetInstance().RemoveDiamods(RemoveValues);
 }
Example #12
0
 //10 diamonds
 public bool Add10_Diamonds()
 {
     //you have to connect to app store payment SDK.
     PlayerExtenalDataProxy.GetInstance().AddDiamond(10);
     return(true);
 }
Example #13
0
 public void IncreaseEXP()
 {
     //use modle layer functions
     PlayerExtenalDataProxy.GetInstance().AddEXP(100);
 }
Example #14
0
 public void Diamond()
 {
     PlayerExtenalDataProxy.GetInstance().AddDiamond(100);
 }
Example #15
0
 public void RemoveGold(int removeGoldValues)
 {
     PlayerExtenalDataProxy.GetInstance().RemoveGold(removeGoldValues);
 }
Example #16
0
 public void AddDiamods(int diamodsValues)
 {
     PlayerExtenalDataProxy.GetInstance().AddDiamods(diamodsValues);
 }
Example #17
0
 public void SetCurrentExp(int exp)
 {
     PlayerExtenalDataProxy.GetInstance().SetCurrentExp(exp);
 }
Example #18
0
 public void SetLevel(int level)
 {
     PlayerExtenalDataProxy.GetInstance().SetLevel(level);
 }
Example #19
0
 public void AddExp(int expValues)
 {
     PlayerExtenalDataProxy.GetInstance().AddExp(expValues);
 }
Example #20
0
 public int GetKillNumber()
 {
     return(PlayerExtenalDataProxy.GetInstance().GetKillNumber());
 }
Example #21
0
 public void UpgradeConition(int expValues)
 {
     PlayerExtenalDataProxy.GetInstance().UpgradeConition(expValues);
 }
Example #22
0
 /// <summary>
 /// get current gold
 /// </summary>
 /// <returns></returns>
 public int GetGold()
 {
     return(PlayerExtenalDataProxy.GetInstance().GetGold());
 }
Example #23
0
 public int GetLevelExp()
 {
     return(PlayerExtenalDataProxy.GetInstance().GetLevelExp());
 }
Example #24
0
    /// <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);
        }
    }
Example #25
0
 public void Killnumbers()
 {
     PlayerExtenalDataProxy.GetInstance().AddKillNumber(100);
 }