/// <summary>
        /// 语言加载单独那出来
        /// </summary>
        public bool LoadLanguage()
        {
            if (languageProvider != null)
            {
                int local = LocalAccountStorage.Get().localLanguage;
                if (local <= 0)
                {
                    SystemLanguage language = Application.systemLanguage;
                    switch (language)
                    {
                    case SystemLanguage.Chinese:
                    case SystemLanguage.ChineseSimplified:
                    case SystemLanguage.ChineseTraditional:
                        language = SystemLanguage.Chinese;
                        break;

                    default:
                        break;
                    }
                    LocalAccountStorage.Get().localLanguage = (int)language;
                    languageProvider.LoadLanguage(language);
                }
                else
                {
                    if (local == (int)SystemLanguage.ChineseSimplified || local == (int)SystemLanguage.ChineseTraditional)
                    {
                        LocalAccountStorage.Get().localLanguage = (int)SystemLanguage.Chinese;
                    }
                    languageProvider.LoadLanguage((SystemLanguage)local);
                }
            }

            return(true);
        }
示例#2
0
    public void OnConfirmClick()
    {
        string name = inputField.value;

        if (string.IsNullOrEmpty(name))
        {
            Tips.Make(LanguageDataProvider.GetValue(10));

            return;
        }
        //判断是否有敏感字符
        bool nameIllegal = false;

        nameIllegal = NameFilterConfigProvider.Instance.nameCheck(name);
        if (nameIllegal)
        {
            Tips.Make(LanguageDataProvider.GetValue(1114));
            return;
        }
        // GuideManager.TriggerGuideEnd(GuildEndEvent.rename);
        NetSystem.Instance.helper.ChangeName(name);

        // 本地存储玩家名称
        LocalPlayer.Get().playerData.name = inputField.value;
        LocalAccountStorage.Get().name = inputField.value;
        LocalStorageSystem.Instance.SaveLocalAccount();

        // 进入PVP界面
        UISystem.Get().HideWindow("SingleClearWindow");
        EventSystem.Instance.FireEvent(EventId.UpdateChaptersWindow);
    }
示例#3
0
 /// <summary>
 /// 获取本地保存的账号
 /// </summary>
 /// <returns>The local account.</returns>
 public string GetLocalAccount()
 {
     if (string.IsNullOrEmpty(localAccount))
     {
         localAccount = LocalAccountStorage.Get().account;
     }
     return(localAccount);
 }
示例#4
0
 private void ModifyLanguange()
 {
     LocalAccountStorage.Get().localLanguage = (int)SelectLanguage;
     LanguageDataProvider.Get().LoadLanguage(SelectLanguage);
     ReFreshLanguage();
     LocalStorageSystem.Get().SaveLocalAccount();
     SetPage();
 }
示例#5
0
 public void FlurryMoneyCostEvent(string costType, string szReason, string strValue)
 {
     flurry_Money.Clear();
     flurry_Money.Add("Account", LocalAccountStorage.Get().account);
     flurry_Money.Add("CostType", costType);
     flurry_Money.Add("CostReason", szReason);
     flurry_Money.Add("CostValue", strValue);
     LogEvent("MoneyCostEvent", flurry_Money);
 }
示例#6
0
    /// <summary>
    /// 应用进入暂停
    /// </summary>
    /// <param name="pauseStatus">If set to <c>true</c> pause status.</param>
    void OnApplicationPause(bool pauseStatus)
    {
        if (!initFinished)
        {
            return;
        }

        if (!pauseStatus)
        {
            // 处理离线时间,暂时不考虑时间作弊的情况,策划要求
            //Debug.Log("Unity : enter server front!!!!");
            //long timeStamp  = LocalAccountStorage.Get().timeStamp;
            //DateTime Start  = new DateTime(1970, 1, 1);
            //Start           = Start.AddSeconds(timeStamp);
            //TimeSpan ts     = DateTime.Now - Start;
            //LocalPlayer.Get().OperatorOffLine((int)ts.TotalSeconds);
        }
        else
        {
            /// 离线保存
            Debug.Log("Unity : enter server back!!!!");
            DateTime start     = new DateTime(1970, 1, 1);
            long     timeStamp = (long)(DateTime.Now - start).TotalSeconds;
            timeStamp = timeStamp - (long)LocalPlayer.Get().PowerRefreshTime;
            LocalAccountStorage.Get().timeStamp = timeStamp;
            LocalStorageSystem.Instance.NeedSaveToDisk();
            LocalStorageSystem.Instance.SaveStorage();

            // 需要对断线进行处理
            if (pauseStatus)
            {
                appPauseBeginTime = Time.realtimeSinceStartup;
            }
            else
            {
                // pvp模式时才重连,单机不管
                GameType gt = BattleSystem.Instance.battleData.gameType;
                if (gt == GameType.PVP || gt == GameType.League)
                {
                    if (Time.realtimeSinceStartup - appPauseBeginTime >= 10)
                    {
                        // 主动断开连接
                        if (NetSystem.Instance.GetConnector().GetConnectStatus() == ConnectionStatus.CONNECTED)
                        {
                            Debug.Log("在后台超过10s,主动断开连接");
                            NetSystem.Instance.Close();
                        }
                        else
                        {
                            // 先屏蔽掉
                            //NetSystem.Instance.DisConnectedCallback ();
                        }
                    }
                }
            }
        }
    }
示例#7
0
 public void FlurryPVPBattleMatchEvent(string matchType, string strLevel, string matchState, string matchTime, string roomID)
 {
     flurry_Match.Clear();
     flurry_Match.Add("Account", LocalAccountStorage.Get().account);
     flurry_Match.Add("MatchType", matchType);
     flurry_Match.Add("Level", strLevel);
     flurry_Match.Add("MatchState", matchState);
     flurry_Match.Add("MatchTime", matchTime);
     flurry_Match.Add("RoomID", roomID);
     LogEvent("MatchBattlePvpEvent", flurry_Match);
 }
示例#8
0
 public void FlurryPVPBattleEndEvent(string matchType, string strLevel, string score, string destroy, string lost, string totalTime)
 {
     flurry_Pvp.Clear();
     flurry_Pvp.Add("Account", LocalAccountStorage.Get().account);
     flurry_Pvp.Add("MatchType", matchType);
     flurry_Pvp.Add("Level", strLevel);
     flurry_Pvp.Add("Score", score);
     flurry_Pvp.Add("Destroy", destroy);
     flurry_Pvp.Add("Lost", lost);
     flurry_Pvp.Add("TotalTime", totalTime);
     LogEvent("EndbattlePvpEvent", flurry_Pvp);
 }
示例#9
0
 /// <summary>
 /// 事件打点,玩家登陆登出, "Login" "Logout"
 /// </summary>
 public void FlurryLoginEvent(string logintype = "Login", string szFrist = "false")
 {
     flurry_Login.Clear();
     flurry_Login.Add("Account", LocalAccountStorage.Get().account);
     flurry_Login.Add("LoginType", logintype);
     flurry_Login.Add("Frist", szFrist);
     flurry_Login.Add("DeviceModel", SystemInfo.deviceModel.ToString());
     flurry_Login.Add("DeviceUniqueIdentifier", SystemInfo.deviceUniqueIdentifier.ToString());
     flurry_Login.Add("OperatingSystem", SystemInfo.operatingSystem);
     flurry_Login.Add("ProcessorType", SystemInfo.processorType);
     LogEvent("LoginEvent", flurry_Login);
 }
示例#10
0
 public void FlurryBattleEndEvent(string strLevel, string szRet, string score, string star, string destroy, string lost, string totalTime)
 {
     flurry_Battle.Clear();
     flurry_Battle.Add("Account", LocalAccountStorage.Get().account);
     flurry_Battle.Add("Level", strLevel);
     flurry_Battle.Add("Type", szRet);
     flurry_Battle.Add("Score", score);
     flurry_Battle.Add("Star", star);
     flurry_Battle.Add("Destroy", destroy);
     flurry_Battle.Add("Lost", lost);
     flurry_Battle.Add("TotalTime", totalTime);
     LogEvent("EndbattleEvent", flurry_Battle);
 }
示例#11
0
 /// <summary>
 /// 从云上拉去数据到内存中
 /// </summary>
 private void RequestAccountAndChapters()
 {
     if (NetSystem.Instance.GetConnector().GetConnectStatus() == ConnectionStatus.CONNECTED)
     {
         string objectName = LocalAccountStorage.Get().account + ".txt";
         string filePath   = UpdateSystem.Get().saveRoot + objectName;
         NetSystem.Instance.helper.GenPresignedUrl(objectName, "GET", "text/plain", filePath, (int)EventId.OnSyncUserAndChapters);
     }
     else
     {
         StartSingleGame();
     }
 }
示例#12
0
 /// <summary>
 /// 生成本地账号
 /// </summary>
 /// <returns>The local account.</returns>
 public string GenerateLocalAccount(bool forceChange = false)
 {
             #if !SERVER
     localAccount = SystemInfo.deviceUniqueIdentifier;
     if (forceChange)
     {
         int rand = UnityEngine.Random.Range(0, 10000);
         localAccount = localAccount + "__force__" + rand.ToString();
     }
     LocalAccountStorage.Get().account = localAccount;
     LocalStorageSystem.Get().NeedSaveToDisk();
             #endif
     return(localAccount);
 }
示例#13
0
        public void SaveLocalAccount(bool bSaveTime = false)
        {
            saveTempName  = LocalAccountStorage.Get().Name();
            saveTempIndex = 0;

            if (bSaveTime)
            {
                DateTime start     = new DateTime(1970, 1, 1);
                long     timeStamp = (long)(DateTime.Now - start).TotalSeconds;
                timeStamp = timeStamp - (long)LocalPlayer.Get().PowerRefreshTime;
                LocalAccountStorage.Get().regtimeSaveFile = timeStamp;
            }
            LocalAccountStorage.Get().Save(this);
        }
示例#14
0
    public void OnClickEnglish(GameObject go)
    {
        AudioManger.Get().PlayEffect("click_down");
        SystemLanguage curLanguage = (SystemLanguage)LocalAccountStorage.Get().localLanguage;

        if (curLanguage == SystemLanguage.English)
        {
            return;
        }

        SelectLanguage = SystemLanguage.English;
        UISystem.Get().ShowWindow("CommonDialogWindow");
        UISystem.Get().OnEventHandler((int)EventId.OnCommonDialog, "CommonDialogWindow",
                                      2, LanguageDataProvider.GetValue(208), new EventDelegate(ModifyLanguange));
    }
示例#15
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="data">Data.</param>
    public void Init(NetMessage.UserData data)
    {
        userId = data.userid;
        name   = data.name;
        //当网络同步成功时,立刻将服务器存储名字覆盖本地名字,并存储
        if (!string.IsNullOrEmpty(name))
        {
            LocalAccountStorage.Get().name = name;
            LocalStorageSystem.Instance.SaveLocalAccount( );
        }
        icon  = data.icon;
        score = data.score;
        //level           = data.Level;
        //money           = 0;
        //unionName       = "";
        //skillPower      = 0;

        if (data.battle_race != null)
        {
        }

        if (data.pack != null)
        {
            pack.Init(data.pack);
        }

        if (data.chest != null)
        {
            chesses = new ChessItem[ChessItem.CHESS_MAX];
            for (int i = 0; i < data.chest.items.Count; i++)
            {
                int slot = data.chest.items[i].slot;
                chesses[slot]    = new ChessItem();
                chesses[slot].id = data.chest.items[i].id;
                if ((chesses[slot].timeout = data.chest.items[i].timeout) > 0)
                {
                    chesses[slot].timefinish = new DateTime(1970, 1, 1).AddSeconds(data.chest.items[i].timeout);
                }
                chesses[slot].slot = data.chest.items[i].slot;
            }
            timechestid    = data.chest.chest_timeboxid;
            battlechestid  = data.chest.chest_winboxid;
            timechest      = data.chest.chest_gainpoint;
            timechestcost  = data.chest.chest_gainconsume;
            curbattlechest = data.chest.chest_winnum;
            maxbattlechest = data.chest.chest_neednum;
        }
    }
示例#16
0
 /// <summary>
 /// 使用此接口调用第三方登录
 /// </summary>
 public void Login()
 {
     if (string.IsNullOrEmpty(LocalAccountStorage.Get().account))
     {
         DateTime start     = new DateTime(1970, 1, 1);
         long     timeStamp = (long)(DateTime.Now - start).TotalSeconds;
         LocalAccountStorage.Get().account      = SystemInfo.deviceUniqueIdentifier;
         LocalAccountStorage.Get().regtimeStamp = timeStamp;
         LocalStorageSystem.Get().SaveLocalAccount();
         Flurry.Instance.FlurryLoginEvent("Login", "0");
     }
     else
     {
         Flurry.Instance.FlurryLoginEvent("Login", "1");
     }
     OnSDKLogin(LocalAccountStorage.Get().account);
 }
示例#17
0
        /// <summary>
        /// 初始化
        /// </summary>
        public bool Init()
        {
            LoggerSystem.Instance.Debug("LocalStorageSystem    init   begin");

            // 注册管理器
            RegisterLocalStorage(LocalAccountStorage.Get());
            RegisterLocalStorage(LocalSettingStorage.Get());
            RegisterLocalStorage(LocalLevelStorage.Get());

            // 获取客户端版本
            appVersion = UpdateSystem.Get().GetAppVersion();

            // 加载存储信息
            LoadStorage();
            LoggerSystem.Instance.Debug("LocalStorageSystem    init   end");
            return(true);
        }
        /// <summary>
        /// 启动时根据本地语言设置,读取数据配置
        /// </summary>
        public void Load()
        {
            mDataList.Clear();
            try
            {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }
                /// 试着用www 读取
                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }

                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Element("languages");
                    if (xElement == null)
                    {
                        return;
                    }

                    SystemLanguage language    = (SystemLanguage)LocalAccountStorage.Get().localLanguage;
                    string         strLanguage = GetLanguageNameConfig(language);

                    var elements = xElement.Elements("language");
                    foreach (var em in elements)
                    {
                        LanguageConfig item = new LanguageConfig();
                        if (item.Load(em, strLanguage))
                        {
                            mDataList.Add(item.mID, item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggerSystem.Instance.Error("data/dictionary.xml resource failed " + e.ToString());
            }
        }
示例#19
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         mPressTimes++;
         StartCoroutine("ResetMPressTimes", 1.0f);//若过了1秒都没有按第2次则重置mPressTimes
         if (mPressTimes == 2)
         {
             DateTime start     = new DateTime(1970, 1, 1);
             long     timeStamp = (long)(DateTime.Now - start).TotalSeconds;
             timeStamp = timeStamp - (long)LocalPlayer.Get().PowerRefreshTime;
             LocalAccountStorage.Get().timeStamp = timeStamp;
             LocalStorageSystem.Instance.NeedSaveToDisk();
             LocalStorageSystem.Instance.SaveStorage();
             Flurry.Instance.FlurryLoginEvent("LogOut", "0");
             Flurry.Instance.EndSession();
             Application.Quit();
         }
     }
 }
示例#20
0
    public void Init()
    {
        // 初始化
        if (Framework.Instance.Init())
        {
            LoggerSystem.Instance.Info("系统启动!");
        }
        else
        {
            LoggerSystem.Instance.Error("系统启动失败!");
        }

        AsyncInitMsg();

        AudioManger.Get().Init();
        BattleSystem.Instance.battleData.root = battleRoot;

        /// 出示数据统计
        Flurry.Instance.FlurryInit();
        Flurry.Instance.LogUserID(LocalAccountStorage.Get().account);

        initFinished = true;
    }
示例#21
0
 /// <summary>
 /// 第三方sdk登录结果回调
 /// </summary>
 public void OnSDKLogin(string account)
 {
     LocalAccountStorage.Get().account = account;
     LocalStorageSystem.Get().NeedSaveToDisk();
     EventSystem.Instance.FireEvent(EventId.OnSDKLoginResult, account);
 }
示例#22
0
    public void SetPage()
    {
        Vector3 onPos    = Vector3.zero;
        Vector3 valuePos = Vector3.zero;

        // 背景音
        onPos    = musicBg.transform.localPosition;
        valuePos = musicBg.transform.localPosition;
        if (LocalSettingStorage.Get().music)
        {
            onPos.x        += 65.0f / 2;          // musicOn.bg / 2;
            valuePos.x     -= 65.0f / 2;
            musicOn.color   = musicBg.color = musicValue.color = btn_on_color;
            musicValue.text = LanguageDataProvider.GetValue(401);
        }
        else
        {
            onPos.x        -= 65.0f / 2;
            valuePos.x     += 65.0f / 2;
            musicOn.color   = musicBg.color = musicValue.color = btn_off_color;
            musicValue.text = LanguageDataProvider.GetValue(402);
        }
        musicOn.transform.localPosition    = onPos;
        musicValue.transform.localPosition = valuePos;

        // 音效
        onPos    = soundBg.transform.localPosition;
        valuePos = soundBg.transform.localPosition;
        if (LocalSettingStorage.Get().sound)
        {
            onPos.x        += 65.0f / 2;
            valuePos.x     -= 65.0f / 2;
            soundOn.color   = soundBg.color = soundValue.color = btn_on_color;
            soundValue.text = LanguageDataProvider.GetValue(401);
        }
        else
        {
            onPos.x        -= 65.0f / 2;
            valuePos.x     += 65.0f / 2;
            soundOn.color   = soundBg.color = soundValue.color = btn_off_color;
            soundValue.text = LanguageDataProvider.GetValue(402);
        }
        soundOn.transform.localPosition    = onPos;
        soundValue.transform.localPosition = valuePos;

        /// 语言
        if (LocalAccountStorage.Get().localLanguage == (int)SystemLanguage.Chinese)
        {
            //chineseValue.text = LanguageDataProvider.GetValue(401);
            chineseOn.gameObject.SetActive(true);
        }
        else
        {
            //chineseValue.text = LanguageDataProvider.GetValue(402);
            chineseOn.gameObject.SetActive(false);
        }

        if (LocalAccountStorage.Get().localLanguage != (int)SystemLanguage.Chinese)
        {
            //englishValue.text = LanguageDataProvider.GetValue(401);
            englishOn.gameObject.SetActive(true);
        }
        else
        {
            //englishValue.text = LanguageDataProvider.GetValue(402);
            englishOn.gameObject.SetActive(false);
        }

        // 效果
        for (int i = 0; i < effectToggles.Length; ++i)
        {
            if (i == LocalSettingStorage.Get().effectLevel)
            {
                effectToggles [i].Set(true, false);
                SetToggleColor(effectToggles [i].gameObject, true);
            }
            else
            {
                effectToggles [i].Set(false, false);
                SetToggleColor(effectToggles [i].gameObject, false);
            }
        }

        // 分兵方式
        for (int i = 0; i < fightOptionToggles.Length; ++i)
        {
            if (i == LocalSettingStorage.Get().fightOption)
            {
                fightOptionToggles [i].Set(true, false);
                SetToggleColor(fightOptionToggles [i].gameObject, true);
            }
            else
            {
                fightOptionToggles [i].Set(false, false);
                SetToggleColor(fightOptionToggles [i].gameObject, false);
            }
        }

        // version
        string appVersion = string.Empty;

        //ConfigSystem.Instance.TryGetConfig ("version", out appVersion);
        version.text = Application.version;

        //ip and bundle
        ipLabel.text = NetSystem.Instance.GetConnector().GetHost().ToString();
        //bundleLabel.text = Application.bundleIdentifier;
    }