示例#1
0
        public MainGame() : base()
        {
            Backend = new GDServerAPI(GDBridge);
            //Backend = new DummyGDServerAPI();

            if (GDConstants.FLAVOR == GDFlavor.IAB)
            {
                GDBridge.IAB.Connect(GDConstants.IABList);
            }

            Profile = new PlayerProfile();

            var sdata = FileHelper.Inst.ReadDataOrNull(GDConstants.PROFILE_FILENAME);             // %LOCALAPPDATA%\IsolatedStorage\...

            if (sdata != null)
            {
                try
                {
#if DEBUG
                    var starttime = Environment.TickCount;
#endif
                    Profile.DeserializeFromString(sdata);
#if DEBUG
                    SAMLog.Debug($"Deserialized profile in {Environment.TickCount - starttime}ms");
#endif
                }
                catch (Exception e)
                {
                    SAMLog.Error("Deserialization", e);

                    Profile = new PlayerProfile();
                    SaveProfile();
                }
            }
            else
            {
                SaveProfile();
            }

            SAMLog.LogEvent += SAMLogOnLogEvent;
            SAMLog.AdditionalLogInfo.Add(GetLogInfo);

            for (int i = 0; i < MAX_LOG_SEND_COUNT; i++)
            {
                LastSendLogTimes[i] = float.MinValue;
            }

            L10NImpl.Init(Profile.Language);

            AddAgent(new HighscoreAgent());

            Inst = this;
        }
示例#2
0
        public MainGame() : base()
        {
            Backend = new SGServerAPI(SGBridge);
            //Backend = new DummySGServerAPI();

            SGBridge.IAB.Connect(SGConstants.IABList);

            Settings = new UserSettings();

            var sdata = FileHelper.Inst.ReadDataOrNull(SGConstants.PROFILE_FILENAME);             // %LOCALAPPDATA%\IsolatedStorage\...

            if (sdata != null)
            {
                try
                {
#if DEBUG
                    var starttime = Environment.TickCount;
#endif
                    Settings.DeserializeFromString(sdata);
#if DEBUG
                    SAMLog.Debug($"Deserialized settings in {Environment.TickCount - starttime}ms");
#endif
                }
                catch (Exception e)
                {
                    SAMLog.Error("Deserialization", e);

                    Settings = new UserSettings();
                    SaveUserConfig();
                }
            }
            else
            {
                SaveUserConfig();
            }

            SAMLog.LogEvent += SAMLogOnLogEvent;
            SAMLog.AdditionalLogInfo.Add(GetLogInfo);

            for (int i = 0; i < MAX_LOG_SEND_COUNT; i++)
            {
                LastSendLogTimes[i] = float.MinValue;
            }

            L10NImpl.Init(Settings.Language);

            Inst = this;
        }