Esempio n. 1
0
    public static void WinSingle()
    {
        DataController.SaveValue("Rating", DataController.GetValue <int>("Rating") + RaitingSingleReward);

        if (DataController.GetValue <int>("LoadMode") == 2)
        {
            winExp = 200;

            winBread = 100;

            DataController.SaveValue("CurrentBossNumber", 1 + DataController.GetValue <int>("CurrentBossNumber"));
        }

        DataController.SaveValue("RatingChange", RaitingSingleReward);

        int expChange = 0;

        expChange = winExp * multDifference;

        DataController.SaveValue("expAdded", expChange);

        int breadChange = 0;

        breadChange = winBread;

        DataController.SaveValue("breadAdded", breadChange);

        DataController.SaveValue("Exp", DataController.GetValue <int>("Exp") + expChange);

        DataController.SaveValue("Bread", DataController.GetValue <int>("Bread") + breadChange);

        PostGameActions(true);
    }
 private void UpdateExp()
 {
     Ground            = GetComponent <Image>();
     CurrentExp        = (float)DataController.GetValue <int>("Exp") % 100f;
     Ground.fillAmount = CurrentExp / maxExp;
     loadingscreen.SetActive(false);
 }
Esempio n. 3
0
    public static void PostGameActions(bool ifWin)
    {
        DataController.SaveValue("GSNotSynced" + DataController.GetValue <string>("username"), 2);

        if (ifWin)
        {
            DataController.SaveValue("WinsForChest", DataController.GetValue <int>("WinsForChest") + 1);
        }
    }
Esempio n. 4
0
 public void SpendSkillPoints(Text Title)
 {
     DataController.SaveValue("GSNotSynced" + DataController.GetValue <string>("username"), 1);
     if (Title.name.Contains("Attack"))
     {
         StatsName = "StatsAttack";
     }
     else if (Title.name.Contains("Agility"))
     {
         StatsName = "StatsAgility";
     }
     else if (Title.name.Contains("Power"))
     {
         StatsName = "StatsPower";
     }
     else if (Title.name.Contains("Strength"))
     {
         StatsName = "StatsStrength";
     }
     else if (Title.name.Contains("Endurance"))
     {
         StatsName = "StatsEndurance";
     }
     else if (Title.name.Contains("Speed"))
     {
         StatsName = "StatsSpeed";
     }
     else if (Title.name.Contains("Sleep"))
     {
         StatsName = "StatsSleep";
     }
     else if (Title.name.Contains("Regen"))
     {
         StatsName = "StatsRegen";
     }
     if (DataController.GetValue <int>("SkillPoints") - (DataController.GetValue <int>("AllPts") + (int)((DataController.GetValue <int>(StatsName + "Incr") + DataController.GetValue <int>(StatsName + "Mine")) * 0.125 + 1)) + 0.01 > 0)
     {
         if ((int)((DataController.GetValue <int>(StatsName + "Incr") + DataController.GetValue <int>(StatsName + "Mine"))) < 40)
         {
             foreach (string name in ServerNames)
             {
                 if (name == StatsName)
                 {
                     //DataController.SaveValue("SpentPoints", (DataController.GetValue<int>("SpentPoints") + (int)((DataController.GetValue<int>(StatsName + "Incr") + DataController.GetValue<int>(StatsName + "Mine")) * 0.125 + 1 - 0.01)));
                     DataController.SaveValue(StatsName + "Incr", 1 + DataController.GetValue <int>(StatsName + "Incr"));
                     DataController.SaveValue("AllPts", (DataController.GetValue <int>("AllPts") + (int)((DataController.GetValue <int>(StatsName + "Incr") + DataController.GetValue <int>(StatsName + "Mine")) * 0.125 + 1 - 0.01)));
                     WasChanged = true;
                     break;
                 }
             }
             ;
         }
     }
 }
 private void updateExp()
 {
     StartMenuTexts = GetComponents <Text>().ToList();
     foreach (Text text in StartMenuTexts)
     {
         if (text.name == "ExpBar")
         {
             text.text = "Exp: " + (DataController.GetValue <int>("currentExp") % 100).ToString() + " / 100";
         }
     }
 }
        public void NewPasswordLogin()
        {
            DataController.SaveValue("password", password.text);

            Debug.Log(password.text);

            var loginRequest = new AuthenticationRequest();

            GameSparks.Core.GSRequestData data = new GameSparks.Core.GSRequestData();

            data.AddString("password", DataController.GetValue <string>("password"));

            data.AddString("action", "resetPassword");

            data.AddString("token", token.text);

            loginRequest.SetScriptData(data);

            loginRequest.SetUserName(DataController.GetValue <string>("username"));

            loginRequest.SetPassword(password.text);

            loginRequest.Send(response =>
            {
                if (response.Errors.GetString("action").Contains("complete"))
                {
                    Warning.SetActive(true);

                    PopUpMessage.ActivatePopUp(delegate {  }, LocalisationSystem.GetLocalisedValue("resetpasswordwarning5"));

                    UIController.SetActivePanel(UI_Element.Login);
                }

                if (response.Errors.GetString("action").Contains("invalid"))
                {
                    Warning.SetActive(true);

                    PopUpMessage.ActivatePopUp(delegate { }, LocalisationSystem.GetLocalisedValue("resetpasswordwarning4") + LocalisationSystem.GetLocalisedValue("password_error"));

                    UIController.SetActivePanel(UI_Element.ConfirmResetPassword);
                }


                Debug.Log("well done " + response.Errors.JSON.ToString());

                if (!response.HasErrors)
                {
                    Debug.Log("Error reseting password.../n" + response.Errors.JSON.ToString());
                }
            });
        }
Esempio n. 7
0
 private void Start()
 {
     RememberMe = DataController.GetValue <int>("RememberMe");
     if (RememberMe > 0)
     {
         username.text = DataController.GetValue <string>("username");
         password.text = DataController.GetValue <string>("password");
     }
     else
     {
         DataController.DeleteValue("username");
         DataController.DeleteValue("password");
     }
 }
Esempio n. 8
0
 public void ReturnSpentSkillPoints(Text Title)
 {
     if (Title.text.StartsWith("Attack"))
     {
         StatsName = "StatsAttack";
     }
     else if (Title.text.StartsWith("Agility"))
     {
         StatsName = "StatsAgility";
     }
     else if (Title.text.StartsWith("Power"))
     {
         StatsName = "StatsPower";
     }
     else if (Title.text.StartsWith("Strength"))
     {
         StatsName = "StatsStrength";
     }
     else if (Title.text.StartsWith("Endurance"))
     {
         StatsName = "StatsEndurance";
     }
     else if (Title.text.StartsWith("Speed"))
     {
         StatsName = "StatsSpeed";
     }
     else if (Title.text.StartsWith("Sleep"))
     {
         StatsName = "StatsSleep";
     }
     else if (Title.text.StartsWith("Regen"))
     {
         StatsName = "StatsRegen";
     }
     foreach (string name in ServerNames)
     {
         if (name == StatsName)
         {
             if (DataController.GetValue <int>(StatsName + "Incr") > 0)
             {
                 DataController.SaveValue("AllPts", (DataController.GetValue <int>("AllPts") - (int)((DataController.GetValue <int>(StatsName + "Incr") + DataController.GetValue <int>(StatsName + "Mine")) * 0.125 + 1 - 0.01)));
                 DataController.SaveValue(StatsName + "Incr", -1 + DataController.GetValue <int>(StatsName + "Incr"));
                 WasChanged = true;
             }
             break;
         }
     }
     ;
 }
Esempio n. 9
0
    public static void LoseOnline()
    {
        int RatingReward = 0;

        RatingReward = (DataController.GetValue <int>("Rating") - DataController.GetValue <int>("RatingOther")) / 4;

        if (RatingReward >= 0)
        {
            RatingReward += 4;

            RatingReward = Mathf.Min(RatingReward, 25);
        }
        else
        {
            RatingReward -= 4;

            RatingReward = Mathf.Min(Mathf.Abs(RatingReward), 10);
        }

        DataController.SaveValue("RatingChange", -RatingReward / 2);

        DataController.SaveValue("Rating", DataController.GetValue <int>("Rating") - RatingReward / 2);

        int expChange = 0;

        expChange = loseExp;

        DataController.SaveValue("expAdded", expChange);

        int breadChange = 0;

        breadChange = loseBread * multDifference;

        DataController.SaveValue("breadAdded", breadChange);

        DataController.SaveValue("Exp", DataController.GetValue <int>("Exp") + expChange / 2);

        DataController.SaveValue("Bread", DataController.GetValue <int>("Bread") + breadChange / 2);

        PostGameActions(false);
    }
Esempio n. 10
0
    public void ResetSkillPoints()
    {
        if (EquipmentManager.instance.currentEquipment[5] != null)
        {
            if ((int)EquipmentManager.instance.currentEquipment[5].equipSlot == 7)
            {
                EquipmentManager.instance.Unequip(5);
            }
        }

        DataController.SaveValue("SkillPoints", DataController.GetValue <int>("SkillPoints") + DataController.GetValue <int>("SpentPoints"));

        DataController.SaveValue("AllPts", 0);

        DataController.SaveValue("SpentPoints", 0);

        foreach (string StatsName in ServerNames)
        {
            DataController.SaveValue(StatsName + "Mine", 0);
            DataController.SaveValue(StatsName + "Incr", 0);
        }
        WasChanged = true;
    }
Esempio n. 11
0
    public static void LoseSingle()
    {
        DataController.SaveValue("RatingChange", -RaitingSingleReward);

        DataController.SaveValue("Rating", DataController.GetValue <int>("Rating") - RaitingSingleReward);

        int expChange = 0;

        expChange = loseExp * multDifference;

        DataController.SaveValue("expAdded", expChange);

        int breadChange = 0;

        breadChange = loseBread;

        DataController.SaveValue("breadAdded", breadChange);

        DataController.SaveValue("Exp", DataController.GetValue <int>("Exp") + expChange);

        DataController.SaveValue("Bread", DataController.GetValue <int>("Bread") + breadChange);

        PostGameActions(false);
    }
Esempio n. 12
0
    public void LoadPlayerBase()
    {
        if (player == null)
        {
            player = new GameProcess();
        }

        player.magicEquipped = DataController.GetValue <string>("EquippedMagicMine");
        player.Lvl           = DataController.GetValue <int>("Exp") / 100;

        MineOrOther = "Mine";

        player.attack    = DataController.GetValue <int>("StatsAttack" + MineOrOther) + DataController.GetValue <int>("StatsAttackIncr");
        player.agility   = DataController.GetValue <int>("StatsAgility" + MineOrOther) + DataController.GetValue <int>("StatsAgilityIncr");
        player.power     = DataController.GetValue <int>("StatsPower" + MineOrOther) + DataController.GetValue <int>("StatsPowerIncr");
        player.strength  = DataController.GetValue <int>("StatsStrength" + MineOrOther) + DataController.GetValue <int>("StatsStrengthIncr");
        player.endurance = DataController.GetValue <int>("StatsEndurance" + MineOrOther) + DataController.GetValue <int>("StatsEnduranceIncr");
        player.speed     = DataController.GetValue <int>("StatsSpeed" + MineOrOther) + DataController.GetValue <int>("StatsSpeedIncr");
        player.sleep     = DataController.GetValue <int>("StatsSleep" + MineOrOther) + DataController.GetValue <int>("StatsSleepIncr");
        player.regen     = DataController.GetValue <int>("StatsRegen" + MineOrOther) + DataController.GetValue <int>("StatsRegenIncr");

        // info about modifs in Equipment class

        player.armorModif  = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierArmor" + MineOrOther)) / 100.0f), 2);
        player.damageModif = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierDamage" + MineOrOther)) / 100.0f), 2);
        player.missModif   = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierMissChance" + MineOrOther)) / 100.0f), 2);
        player.critModif   = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierCriticalChance" + MineOrOther)) / 100.0f), 2);
        player.bashModif   = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierBashChance" + MineOrOther)) / 100.0f), 2);;
        player.stunModif   = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierStunChance" + MineOrOther)) / 100.0f), 2);
        player.blockModif  = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierBlockChance" + MineOrOther)) / 100.0f), 2);
        player.magicModif  = (float)Math.Round((double)((DataController.GetValue <int>("TotalModifierMagic" + MineOrOther)) / 100.0f), 2);

        //Debug.Log(DataController.GetValue<int>("TotalModifierBlockChance" + MineOrOther) + "  data controller value from clothes, and player modif: " + player.blockModif + ", and player Magic modif to check if its working properly: " + player.magicModif);

        LoadPlayerSecondary(player);
    }
 void OnEnable()
 {
     displayName.text = DataController.GetValue <string>("displayName");
 }
Esempio n. 14
0
    public void UpdateBread()
    {
        BreadAmmount = GetComponent <Text>();

        BreadAmmount.text = DataController.GetValue <int>("Bread").ToString();
    }
        /// <summary>
        /// User Login
        /// </summary>>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="eventName"></param>
        public static void Login(string username, string password, string eventName)
        {
            if (DataController.GetValue <string>("LastValidusername") != username)
            {
                if (DataController.GetValue <string>("LastValidusername") != "")
                {
                    Login(DataController.GetValue <string>("LastValidusername"), DataController.GetValue <string>("LastValidPassword"), null);
                }
            }

            DataController.SaveValue("username", username);

            StatsList = new List <long>();

            EquipmentList = new List <long>();

            OtherStuffList = new List <long>();

            StatsList = new List <long>();

            EquipmentList = new List <long>();

            PrimaryStuffList = new List <long>();

            if (DataController.GetValue <int>("Rating") >= 0)
            {
                var newRequest = new GameSparks.Api.Requests.LogEventRequest();// DataController.GetValue<int>("Rating"));

                newRequest.SetEventKey("RATING_UPDATE").SetEventAttribute("Rating", DataController.GetValue <int>("Rating")).Send(response =>
                {
                });
            }

            var newRequest1 = new GameSparks.Api.Requests.LeaderboardDataRequest();

            newRequest1.SetLeaderboardShortCode("LeaderboardRating").SetEntryCount(35).Send(response =>
            {
                Debug.Log(response.BaseData.JSON);

                LeaderBoardsScript.Ranks = new List <long?>();

                LeaderBoardsScript.Names = new List <string>();

                LeaderBoardsScript.Ratings = new List <long?>();

                foreach (var gd in response.BaseData.GetGSDataList("data"))
                {
                    LeaderBoardsScript.Ranks.Add(gd.GetLong("rank"));

                    LeaderBoardsScript.Names.Add(gd.GetString("userName"));

                    LeaderBoardsScript.Ratings.Add(gd.GetLong("Rating"));

                    //Debug.Log(gd.GetString("userName"));

                    //Debug.Log(gd.GetLong("Rating"));
                }
            });

            Debug.Log("Authentication...");
            var loginRequest = new AuthenticationRequest();


            GameSparks.Core.GSRequestData data = new GameSparks.Core.GSRequestData();
            if (DataController.GetValue <int>("GSNotSynced" + username) > 0 && DataController.GetValue <string>("LastValidusername") == username)
            {
                foreach (string attr in ServerNamz)
                {
                    Debug.Log(DataController.GetValue <int>(attr + "Mine"));
                    StatsList.Add((long)DataController.GetValue <int>(attr + "Mine"));
                }
                data.AddNumberList("Stats", StatsList);

                foreach (string TypeItem in Equipment.ForInvLoad)
                {
                    foreach (string Name in EquipmentNames)
                    {
                        EquipmentList.Add((long)DataController.GetValue <int>(Name + TypeItem + "ammount"));
                    }
                }
                data.AddNumberList("Equipment", EquipmentList);

                int tempNum = 0;

                foreach (int num in CelebrationAnimation.Prices)
                {
                    Debug.Log(num);

                    if (DataController.GetValue <int>("WinAnimNumberMine" + tempNum + "ammount") > 0)
                    {
                        OtherStuffList.Add(1);
                    }
                    else
                    {
                        OtherStuffList.Add(0);
                    }
                    tempNum += 1;
                }

                PrimaryStuffList.Add(DataController.GetValue <int>("Exp"));

                PrimaryStuffList.Add(DataController.GetValue <int>("Bread"));

                PrimaryStuffList.Add(DataController.GetValue <int>("SkillPoints"));

                PrimaryStuffList.Add(DataController.GetValue <int>("Rating"));

                Debug.Log(DataController.GetValue <int>("SkillPoints"));

                data.AddNumberList("OtherStuffList", OtherStuffList);

                data.AddNumberList("PrimaryStuffList", PrimaryStuffList);
            }

            loginRequest.SetUserName(username);
            loginRequest.SetPassword(password);
            loginRequest.SetScriptData(data);


            loginRequest.Send(response =>
            {
                if (!response.HasErrors)
                {
                    GameSparks.Core.GSData GSList = response.ScriptData;
                    foreach (string atributeName in ServerNamz)
                    {
                        DataController.SaveValue(atributeName + "Mine", (int)GSList.GetInt(atributeName));
                    }
                    foreach (string TypeItem in Equipment.ForInvLoad)
                    {
                        foreach (string Name in EquipmentNames)
                        {
                            if (GSList.GetGSData("BoughtOrNot").ContainsKey(Name + TypeItem))
                            {
                                if (GSList.GetGSData("BoughtOrNot").GetInt(Name + TypeItem) > 0)
                                {
                                    DataController.SaveValue(Name + TypeItem + "ammount", 1);
                                }
                                else
                                {
                                    DataController.SaveValue(Name + TypeItem + "ammount", 0);
                                }
                            }
                            else
                            {
                                DataController.SaveValue(Name + TypeItem + "ammount", 0);
                            }
                        }
                    }
                    foreach (var vg in GSList.GetGSDataList("VirtualGoodsList"))
                    {
                        foreach (string modifier in EqModifiers)
                        {
                            if (vg.GetGSData("currencyCosts").GetInt(modifier) != null)
                            {
                                DataController.SaveValue(vg.GetString("name") + modifier, (int)vg.GetGSData("currencyCosts").GetInt(modifier));
                                //Debug.Log(vg.GetString("name"));
                            }
                        }
                        //Debug.Log(vg.GetString("name"));
                        DataController.SaveValue(vg.GetString("name") + "Price", (int)vg.GetGSData("currencyCosts").GetInt("Bread"));
                        DataController.SaveValue(vg.GetString("name") + "SellPrice", (int)vg.GetGSData("currencyCosts").GetInt("BreadPrice"));
                    }

                    int tempNum = 0;
                    long?value  = GSList.GetLong("Anim" + tempNum);
                    while (value != null)
                    {
                        DataController.SaveValue("WinAnimNumberMine" + tempNum + "ammount", (int)value);
                        tempNum += 1;
                        value    = GSList.GetLong("Anim" + tempNum);
                    }

                    for (int i = tempNum; i < CelebrationAnimation.Prices.Count; i++)
                    {
                        DataController.SaveValue("WinAnimNumberMine" + i + "ammount", 0);
                    }

                    long?Exp = GSList.GetLong("TotalExp");
                    DataController.SaveValue("Exp", (int)Exp);

                    long?Bread = GSList.GetLong("TotalBread");
                    DataController.SaveValue("Bread", (int)Bread);

                    long?SkillPoints = GSList.GetLong("TotalSkillPoints");
                    DataController.SaveValue("SkillPoints", (int)SkillPoints);

                    long?Rating = GSList.GetLong("Rating");
                    DataController.SaveValue("Rating", (int)Rating);

                    Debug.Log(DataController.GetValue <int>("SkillPoints"));


                    DataController.SaveValue("GSNotSynced" + username, 0);
                    Debug.Log("Player authenticated! \n Name:" + response.DisplayName + response.ScriptData.JSON);// + response.ScriptData);//.ScriptData.JSON.ToString());


                    IsUserLoggedIn = false;

                    EventManager.TriggerEvent(eventName, response.DisplayName);

                    DataController.SaveValue("LastValidPassword" + username, password);

                    DataController.SaveValue("LastValidusername", username);
                }
                else
                {
                    ResetPassword.instance.Warning.SetActive(true);

                    PopUpMessage.ActivatePopUp(delegate { UIController.SetActivePanel(UI_Element.Login); }, LocalisationSystem.GetLocalisedValue("loginerror1"));

                    Debug.Log("Error authenticating player.../n" + response.Errors.JSON.ToString());

                    EventManager.TriggerEvent(eventName, "");
                }
            });
        }
        /// <summary>
        /// Log the user in as a guest.
        /// </summary>
        /// <param name="eventName"></param> The event that will be called after the device authentication response
        public static void DeviceAuthentication(string eventName)
        {
            Debug.Log("Device authentication...");

            Login(DataController.GetValue <string>("username"), DataController.GetValue <string>("LastValidPassword" + DataController.GetValue <string>("username")), null);

            //DataController.GetValue<string>("LastValidPassword" + DataController.GetValue<string>("username"));

            //DataController.SaveValue("username", "");

            var deviceAuthenticationRequest = new DeviceAuthenticationRequest();

            deviceAuthenticationRequest.Send(response =>
            {
                if (!response.HasErrors)
                {
                    GameSparks.Core.GSData GSList = response.ScriptData;

                    foreach (var vg in GSList.GetGSDataList("VirtualGoodsList"))
                    {
                        foreach (string modifier in EqModifiers)
                        {
                            if (vg.GetGSData("currencyCosts").GetInt(modifier) != null)
                            {
                                DataController.SaveValue(vg.GetString("name") + modifier, (int)vg.GetGSData("currencyCosts").GetInt(modifier));
                            }
                        }
                        DataController.SaveValue(vg.GetString("name") + "Price", (int)vg.GetGSData("currencyCosts").GetInt("Bread"));
                        DataController.SaveValue(vg.GetString("name") + "SellPrice", (int)vg.GetGSData("currencyCosts").GetInt("BreadPrice"));
                    }
                    foreach (string atributeName in ServerNamz)
                    {
                        DataController.SaveValue(atributeName + "Mine", 0);
                    }
                    foreach (string TypeItem in Equipment.ForInvLoad)
                    {
                        foreach (string Name in EquipmentNames)
                        {
                            DataController.SaveValue(Name + TypeItem + "ammount", 0);
                        }
                    }
                    Debug.Log("Player autheticated!\nName: " + response.DisplayName);

                    EventManager.TriggerEvent(eventName, response.DisplayName);

                    IsUserLoggedIn = true;

                    DataController.SaveValue("GSNotSynced" + DataController.GetValue <string>("username"), 0);

                    DataController.SaveValue("Exp", 0);

                    DataController.SaveValue("Bread", 0);

                    DataController.SaveValue("SkillPoints", 0);

                    DataController.SaveValue("Rating", 0);

                    for (int i = 0; i < CelebrationAnimation.Prices.Count; i++)
                    {
                        DataController.SaveValue("WinAnimNumberMine" + i + "ammount", 0);
                    }
                }
                else
                {
                    Debug.Log("Error authenticating player... \n: " + response.Errors.JSON.ToString());

                    EventManager.TriggerEvent(eventName, "");
                }
            });
        }
 private void Start()
 {
     UserNam      = GetComponent <Text>();
     UserNam.text = DataController.GetValue <string>("displayName");
 }
        public void GetToken()
        {
            DataController.SaveValue("username", username.text);

            var loginRequest = new AuthenticationRequest();

            GameSparks.Core.GSRequestData data = new GameSparks.Core.GSRequestData();

            data.AddString("action", "passwordRecoveryRequest");

            data.AddString("email", email.text);

            loginRequest.SetScriptData(data);

            loginRequest.SetUserName(DataController.GetValue <string>("username"));

            loginRequest.SetPassword("");

            loginRequest.Send(response => {
                if (!response.HasErrors)
                {
                    Warning.SetActive(true);

                    Warning.GetComponentsInChildren <Button>()[1].gameObject.SetActive(false);

                    PopUpMessage.ActivatePopUp(delegate { UIController.SetActivePanel(UI_Element.ConfirmResetPassword); }, LocalisationSystem.GetLocalisedValue("resetpasswordwarning1"));
                }
                else
                {
                    Debug.Log("Error authenticating player.../n" + response.Errors.JSON.ToString());

                    Debug.Log(response.Errors.GetString("action"));

                    if (response.Errors.ContainsKey("action"))
                    {
                        Warning.SetActive(true);

                        //Warning.GetComponentsInChildren<Button>()[1].gameObject.SetActive(false);

                        if (response.Errors.GetString("action").Contains("complete"))
                        {
                            Debug.Log("warn1");

                            UIController.SetActivePanel(UI_Element.ConfirmResetPassword);

                            PopUpMessage.ActivatePopUp(delegate { UIController.SetActivePanel(UI_Element.ConfirmResetPassword); }, LocalisationSystem.GetLocalisedValue("resetpasswordwarning1"));
                        }
                        else if (response.Errors.GetString("action").Contains("email") || response.Errors.GetString("action").Contains("invalid"))
                        {
                            Debug.Log("warn2");

                            PopUpMessage.ActivatePopUp(delegate { UIController.SetActivePanel(UI_Element.ResetPassword); }, LocalisationSystem.GetLocalisedValue("resetpasswordwarning2"));
                        }
                        else
                        {
                            Debug.Log("exception");
                        }
                    }
                }
            });
        }
Esempio n. 19
0
    public void MoveIn(string InOrOut)
    {
        //Debug.Log(DataController.GetValue<int>("SkillPoints") + "   " + DataController.GetValue<int>("SpentPoints") + "   " + DataController.GetValue<int>("AllPts"));
        //CharacterInfo = GameObject.FindGameObjectsWithTag("PlayerInfo")[0];
        StatsInf.SetActive(false);
        if (InOrOut == "In")
        {
            DataController.SaveValue("SpentPoints", 0);

            int temp;

            foreach (string StatsName in ServerNames)
            {
                temp = (DataController.GetValue <int>(StatsName + "Incr") + DataController.GetValue <int>(StatsName + "Mine"));

                if (temp >= 8)
                {
                    DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + 8);
                    if (temp >= 16)
                    {
                        DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + 16);
                        if (temp >= 24)
                        {
                            DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + 24);
                            if (temp >= 32)
                            {
                                DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + 32);

                                DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + (temp - 32) * 5);
                            }
                            else
                            {
                                DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + (temp - 24) * 4);
                            }
                        }
                        else
                        {
                            DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + (temp - 16) * 3);
                        }
                    }
                    else
                    {
                        DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + (temp - 8) * 2);
                    }
                }
                else
                {
                    DataController.SaveValue("SpentPoints", (DataController.GetValue <int>("SpentPoints")) + temp);
                }
            }

            foreach (string StatsName in ServerNames)
            {
                DataController.DeleteValue(StatsName + "Incr");
                DataController.DeleteValue("AllPts");
            }
            WasChanged = true;
            if (CharacterInfo.transform.position.y > 0)
            {
                CharacterInfo.transform.position = new Vector3(-1000, -1000, 0);
            }
            else
            {
                CharacterInfo.transform.position = new Vector3(1, 1.7f, -2);
            }
        }
        else
        {
            if (DataController.GetValue <int>("StatsPowerMine") < 16 && EquipmentManager.instance.currentEquipment[7] != null)
            {
                EquipmentManager.instance.currentEquipment[4] = null;
                EquipmentManager.instance.currentEquipment[5] = null;
                EquipmentManager.instance.Unequip(7);
            }
            foreach (string StatsName in ServerNames)
            {
                DataController.SaveValue(StatsName + "Mine", DataController.GetValue <int>(StatsName + "Incr") + DataController.GetValue <int>(StatsName + "Mine"));
                DataController.DeleteValue(StatsName + "Incr");
            }

            DataController.SaveValue("SpentPoints", DataController.GetValue <int>("SpentPoints") + DataController.GetValue <int>("AllPts"));

            DataController.SaveValue("SkillPoints", DataController.GetValue <int>("SkillPoints") - DataController.GetValue <int>("AllPts"));

            DataController.DeleteValue("AllPts");
        }

        //Debug.Log(DataController.GetValue<int>("SkillPoints") + "   " + DataController.GetValue<int>("SpentPoints") + "   " + DataController.GetValue<int>("AllPts"));
    }
Esempio n. 20
0
    void Update()
    {
        if (WasChanged == true)
        {
            LoadPlayerBase();
            //Debug.Log("Strength and Endurance: " + player.strength + "    " + player.endurance);
            count = 0;
            foreach (Image img in BarsList)
            {
                CurStat     = DataController.GetValue <int>(ServerNames[count] + "Mine");
                CurIncrStat = DataController.GetValue <int>(ServerNames[count] + "Incr");
                title       = img.GetComponentInChildren <Text>();
                title.text  = LocalisationSystem.GetLocalisedValue(ServerNames[count].Substring(5).ToLower()) + ": " + (CurStat + CurIncrStat);

                Price = (CurStat + CurIncrStat) / 8 + 1;
                if (Price < 6)
                {
                    img.GetComponentsInChildren <Text>()[3].text = (Price).ToString();
                }
                else
                {
                    img.GetComponentsInChildren <Text>()[3].text = "";
                }


                img.fillAmount = ((40f - CurStat - CurIncrStat) / 40f);
                SpecialsList   = img.GetComponentsInChildren <Image>();
                for (int i = 1; i <= 5; i++)
                {
                    if (i * 8 <= (CurStat + CurIncrStat))
                    {
                        SpecialsList[i].color = Color.yellow;
                    }
                    else
                    {
                        SpecialsList[i].color = Color.black;
                    }
                }
                count += 1;
            }
            foreach (Text text in Texts)
            {
                if (text.name.StartsWith("Modifier"))
                {
                    if (text.name == "ModifierCritical")
                    {
                        text.text = (int)(DataController.GetValue <int>("Total" + text.name + "ChanceMine") + player.critModif * 100) + " %";
                    }
                    else if (text.name == "ModifierBash")
                    {
                        text.text = (int)(DataController.GetValue <int>("Total" + text.name + "ChanceMine") + player.bashModif * 100) + " %";
                    }
                    else if (text.name == "ModifierStun")
                    {
                        text.text = (int)(DataController.GetValue <int>("Total" + text.name + "ChanceMine") + player.stunModif * 100) + " %";
                    }
                    else if (text.name == "ModifierMiss")
                    {
                        text.text = (int)(DataController.GetValue <int>("Total" + text.name + "ChanceMine") + player.missModif * 100) + " %";
                    }
                }
                if (text.name.StartsWith("Stats"))
                {
                    text.text = (DataController.GetValue <int>(text.name + "Mine") + DataController.GetValue <int>(text.name + "Incr")).ToString();
                }
                if (text.name == "AllSkillPoints")
                {
                    text.text = (DataController.GetValue <int>("SkillPoints") - DataController.GetValue <int>("AllPts")).ToString();
                }
                if (text.name.Contains("MagDamage"))
                {
                    if (DataController.GetValue <int>("StatsSleepMine") + DataController.GetValue <int>("StatsSleepIncr") >= 16)
                    {
                        if (DataController.GetValue <string>("EquippedMagic") != "")
                        {
                            text.text = LocalisationSystem.GetLocalisedValue("magic") + " : " + LocalisationSystem.GetLocalisedValue(DataController.GetValue <string>("EquippedMagicMine").ToLower()) + "\n";
                            if (DataController.GetValue <string>("EquippedMagicMine") != "Curse")
                            {
                                text.text += LocalisationSystem.GetLocalisedValue("Damage") + " : " + Conv.MagicDmgFunc(player) + " + " + (int)(Conv.MagicDmgFunc(player) / Helper.debuffDmgMultCurse) + " x" +
                                             Conv.MagicDurationFunc(player) + "\n";
                            }
                            else
                            {
                                text.text += LocalisationSystem.GetLocalisedValue("Damage") + " : " + Conv.MagicDmgFunc(player) + " + " + (int)(Conv.MagicDmgFunc(player) / Helper.debuffDmgMultFire) + " x" +
                                             Conv.MagicDurationFunc(player) + "\n";
                            }

                            text.text += LocalisationSystem.GetLocalisedValue("magic_debuff_chance") + " : " + (int)(Conv.MagicDebuffChance(player)) + " %" + "\n"; // magic_debuff_chance
                            text.text += LocalisationSystem.GetLocalisedValue("magic_debuff_duration") + " : " + Conv.MagicDurationFunc(player) + " Turns";         //magic_debuff_duration
                        }
                        else
                        {
                            text.text = "";
                        }
                    }
                    else
                    {
                        text.text = LocalisationSystem.GetLocalisedValue("magic_dmg") + "  : " + 0; // magic_dmg
                    }
                }
                if (text.name.StartsWith("Cnt"))
                {
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "Ba")
                    {
                        text.text = ((int)(Conv.DmgFunc(player) * (1 + player.damageModif))).ToString();
                    }
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "Bl")
                    {
                        text.text = ((int)((Conv.BlockFunc(player) + player.blockModif) * 100)).ToString() + " %";
                    }
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "Dm")
                    {
                        text.text = ((int)((Conv.DmgRedFunc(player) + player.armorModif) * 100)).ToString() + " %";
                    }
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "Tl")
                    {
                        text.text = player.maxHealth.ToString();
                    }
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "Tt")
                    {
                        text.text = player.maxStamina.ToString();
                    }
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "Mo")
                    {
                        text.text = (Conv.MoveFunc(player)).ToString();
                    }
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "St")
                    {
                        text.text = (Conv.StaminaRestoreFunc(player)).ToString();
                    }
                    if (text.name.ToCharArray()[3].ToString() + text.name.ToCharArray()[4].ToString() == "HP")
                    {
                        text.text = (Conv.HealthRestoreFunc(player)).ToString();
                    }
                }
            }

            WasChanged = false;
        }
    }