예제 #1
0
    public void LoadWeaths()
    {
        if (PlayerModel.CLEAR_ALL)
        {
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.WEALTH);
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.ENERGY_BUY);
        }

        string WEALTH = PlayerPrefsUtil.GetString(PlayerPrefsUtil.WEALTH);

        wealths = JsonMapper.ToObject <List <WealthInfo> >(WEALTH);
        if (wealths == null)
        {
            wealths = new List <WealthInfo>();

            for (int i = 0; i < GameMgr.resourceMgr.config_wealth.data.Count; i++)
            {
                config_wealth_item config_item = GameMgr.resourceMgr.config_wealth.data[i];

                wealths.Add(CreatWealthInfo(config_item.id, config_item.firstCount, config_item.limitCount));
            }

            SaveWealths();
        }
        CheckEnergyRecover(true);
        ClockModel.Instance.clockEvent += OnClockEvent;
    }
예제 #2
0
    static int GetString(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        string arg0 = LuaScriptMgr.GetLuaString(L, 1);
        string o    = PlayerPrefsUtil.GetString(arg0);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
예제 #3
0
 private void Login_PackModeClick()
 {
     if (ApplicationMgr.Instance.GamePackMode == ApplicationMgr.PackMode.None)
     {
         string data = "{\"country\":\"CN\",\"province\":\"Guangdong\",\"headimgurl\":\"http://wx.qlogo.cn/mmopen/HmVQlX9WkBuWU6xey4ocGHewjEwC7lr3picwqubjzUibZ8PEiaSlqL9yhfm3y17t5BaaJJYaEqDTiapKQkz2h53GmNY3De6kJlAQ/0\",\"unionid\":\"oOvCQwEr1gmzhw3pFAsPbysCEC-A\",\"openid\":\"omFZUwOVvjp4_QznKyFZjW8tvZLo\",\"nickname\":\"take my hand222\\ue110\\ue329\",\"city\":\"Jiangmen\",\"sex\":2,\"language\":\"zh_CN\",\"privilege\":[]}";
         WeChatLoginClick(data);
         //mUIMainModel.SystemInfoReq = SystemInfoReq.Init();
         //mUIMainModel.PlayerInfo = new UserInfo("黑崎一护");
         //Net.Instance.Send((int)ActionType.Regist, OnRegistCallback, null);
     }
     else if (ApplicationMgr.Instance.GamePackMode == ApplicationMgr.PackMode.Random)
     {           //PlayerPrefsUtil.DeleteAll ();
         string passId   = PlayerPrefsUtil.GetString(PassIdKey);
         string nickName = PlayerPrefsUtil.GetString(TempNickNameKey);
         string openID   = PlayerPrefsUtil.GetString(OpenIdKey);
         if (string.IsNullOrEmpty(passId))
         {
             int num = UnityEngine.Random.Range(10, 999);
             mUIMainModel.SystemInfoReq = new SystemInfoReq("kkk200" + num);
             mUIMainModel.PlayerInfo    = new UserInfo("Test" + num);
             Net.Instance.Send((int)ActionType.Regist, OnRegistCallback, null);
         }
         else
         {
             mUIMainModel.PlayerInfo               = new UserInfo(nickName);
             mUIMainModel.SystemInfoReq            = new SystemInfoReq(openID);
             mUIMainModel.SystemInfoReq.PassportID = passId;
             Net.Instance.Send((int)ActionType.Login, OnLoginCallback, null);
         }
     }
     else if (ApplicationMgr.Instance.GamePackMode == ApplicationMgr.PackMode.WeChat)
     {
         if (mSwitchAccount.value)
         {
             PlayerPrefsUtil.DeleteKey(UserInfoKey);
             ApplicationMgr.Instance.ShareSDK.CancelAuthorize(PlatformType.WeChat);
         }
         string data = PlayerPrefsUtil.GetString(UserInfoKey);
         if (data.IsNullOrEmpty())
         {
             ApplicationMgr.Instance.ShareSDK.Authorize(PlatformType.WeChat);
         }
         else
         {
             WeChatLoginClick(data);
         }
     }
 }
예제 #4
0
    public void InitGuild()
    {
        if (PlayerModel.CLEAR_ALL)
        {
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.GUILD);
            guidingItem = null;
            shield      = true;
        }

        string guildInfoStr = PlayerPrefsUtil.GetString(PlayerPrefsUtil.GUILD);

        guildInfo = JsonMapper.ToObject <GuildInfo>(guildInfoStr);
        if (guildInfo == null)
        {
            guildInfo = new GuildInfo();
        }
        if (guildInfo.completeRoots == null)
        {
            guildInfo.completeRoots = new List <int>();
        }
        if (guildInfo.completeKeys == null)
        {
            guildInfo.completeKeys = new List <int>();
        }

        guildRoots = new List <config_guild_item>();
        List <config_guild_item> configdata = GameMgr.resourceMgr.config_guild.data;

        for (int i = 0; i < configdata.Count; i++)
        {
            config_guild_item item = (config_guild_item)configdata[i];

            if (item.id == item.root_id)
            {
                guildRoots.Add(item);
                if (PlayerModel.CLEAR_ALL)
                {
                    item.SetCompleteTemp(false);
                }
            }
        }

        //uiCamera = GameObject.Find("UICamera").GetComponent<Camera>();
    }
예제 #5
0
    public static void InitLang()
    {
        if (PlayerPrefsUtil.GetString(PlayerPrefsUtil.LANGUAGE) != "")
        {
            LANG_DEFAULT = PlayerPrefsUtil.GetString(PlayerPrefsUtil.LANGUAGE);
        }

        langDic = new Dictionary <string, string>();
        string content = GameMgr.resourceMgr.GetTextString("txt/language.ab", LANG_DEFAULT);

        string[] txtArr = content.Split('\n');
        foreach (string txt in txtArr)
        {
            if (txt != "")
            {
                string[] txts = txt.Split('=');
                if (txts.Length > 1)
                {
                    langDic.Add(txts[0], txts[1].Split('\r')[0]);
                }
            }
        }
    }
예제 #6
0
    public void LoadSkillTemplets()
    {
        if (PlayerModel.CLEAR_ALL)
        {
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.SKILL_LV);
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.SKILL_SELECT);
        }

        string SKILL_SELECTStr = PlayerPrefsUtil.GetString(PlayerPrefsUtil.SKILL_SELECT);

        skillSelects = JsonMapper.ToObject <List <int> >(SKILL_SELECTStr);

        string     SKILL_LVStr = PlayerPrefsUtil.GetString(PlayerPrefsUtil.SKILL_LV);
        List <int> SKILL_LVs   = JsonMapper.ToObject <List <int> >(SKILL_LVStr);

        skillGroups = new List <SkillGroupInfo>();

        List <config_skill_item> skills = ResModel.Instance.config_skill.data;

        for (int i = 0; i < skills.Count; i++)
        {
            config_skill_item skill_item = skills[i];

            SkillTempletInfo skillTempletInfo = new SkillTempletInfo();
            skillTempletInfo.config = skill_item;
            if (SKILL_LVs != null)
            {
                skillTempletInfo.lv = SKILL_LVs[i];
            }

            SkillGroupInfo findSkillGroupInfo = null;

            for (int n = 0; n < skillGroups.Count; n++)
            {
                SkillGroupInfo checker = skillGroups[n];
                if (checker.GetGroupId() == skill_item.groupId && findSkillGroupInfo == null)
                {
                    findSkillGroupInfo = checker;
                }
            }

            if (findSkillGroupInfo == null)
            {
                SkillGroupInfo skillTempletGroupInfo = new SkillGroupInfo();
                skillGroups.Add(skillTempletGroupInfo);
                skillTempletGroupInfo.skillTemplets.Add(skillTempletInfo);
            }
            else
            {
                findSkillGroupInfo.skillTemplets.Add(skillTempletInfo);
            }
        }

        if (skillSelects == null)
        {
            skillSelects = new List <int>();
            for (int n = 0; n < skillGroups.Count; n++)
            {
                List <SkillTempletInfo> skillTemplets = skillGroups[n].skillTemplets;
                for (int m = 0; m < skillTemplets.Count; m++)
                {
                    SkillTempletInfo skillTemplet = skillTemplets[m];
                    if (skillTemplet.config.type == 1)
                    {
                        skillSelects.Add(skillTemplet.config.cellId);
                    }
                }
            }
        }

        InitHole();
        UpdateStarInfo();
    }
예제 #7
0
    public void LoadMaps(int maxId = 0)
    {
        if (PlayerModel.CLEAR_ALL)
        {
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.CHAPTER);
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.PASS_MAP);
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.NEW_MAP);
        }

        string CHAPTER = PlayerPrefsUtil.GetString(PlayerPrefsUtil.CHAPTER);

        chapters = JsonMapper.ToObject <List <ChapterInfo> >(CHAPTER);
        if (chapters == null)
        {
            chapters = new List <ChapterInfo>();
        }

        string PASS_MAP = PlayerPrefsUtil.GetString(PlayerPrefsUtil.PASS_MAP);

        passMaps = JsonMapper.ToObject <List <MapInfo> >(PASS_MAP);
        if (passMaps == null)
        {
            passMaps = new List <MapInfo>();
        }

        string NEW_MAP = PlayerPrefsUtil.GetString(PlayerPrefsUtil.NEW_MAP);

        newMaps = JsonMapper.ToObject <List <MapInfo> >(NEW_MAP);

        if (newMaps == null)
        {
            newMaps = new List <MapInfo>();
            OpenLevel(20001);
        }
        else
        {
            if (newMaps.Count == 0)
            {
                MapInfo mapInfo = passMaps[passMaps.Count - 1];
                selectChapter = GameMgr.resourceMgr.config_chapter.GetChapterByMap(mapInfo);
            }
            else
            {
                MapInfo mapInfo = newMaps[newMaps.Count - 1];
                selectChapter = GameMgr.resourceMgr.config_chapter.GetChapterByMap(mapInfo);
            }
            if (selectChapter == null)
            {
                selectChapter = (config_chapter_item)GameMgr.resourceMgr.config_chapter.data[GameMgr.resourceMgr.config_chapter.data.Count - 1];
            }
        }

        if (maxId > 0)
        {
            WealthInfo coinInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);
            WealthInfo gemInfo  = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem);

            newMaps  = new List <MapInfo>();
            passMaps = new List <MapInfo>();
            int openId = 0;
            for (int j = 0; j < GameMgr.resourceMgr.config_map.data.Count; j++)
            {
                config_map_item config_map_item = GameMgr.resourceMgr.config_map.data[j];
                if (config_map_item.id <= maxId)
                {
                    MapInfo mapInfo = new MapInfo();
                    mapInfo.configId = config_map_item.id;
                    mapInfo.star     = 2;
                    mapInfo.score    = config_map_item.GetJudgeScores()[mapInfo.star - 1];
                    passMaps.Add(mapInfo);

                    coinInfo.count += (int)GameModel.Instance.GetGameConfig(1005);
                    gemInfo.count  += (int)GameModel.Instance.GetGameConfig(1006);;

                    for (int i = 0; i < SkillTempletModel.Instance.skillGroups.Count; i++)
                    {
                        SkillGroupInfo skillTempletGroupInfo = SkillTempletModel.Instance.skillGroups[i];

                        int groupId = skillTempletGroupInfo.GetGroupId();

                        WealthInfo bottleInfo = PlayerModel.Instance.GetWealth(groupId);
                        bottleInfo.count += 60;
                    }
                    openId = config_map_item.id + 1;
                }
            }
            OpenLevel(openId);
            PlayerModel.Instance.SaveWealths();
            SaveMap();
        }

        UpdateStarInfo();
    }