Exemple #1
0
        public MainGame(IOperatingSystemBridge b) : base(b)
        {
            Backend = new GDServerAPI(b);
            //Backend = new DummyGDServerAPI();

            if (GDConstants.USE_IAB)
            {
                Bridge.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;
        }
Exemple #2
0
        protected MonoSAMGame(IOperatingSystemBridge bridge)
        {
            try
            {
                FileHelper.RegisterSystemSecificHandler(bridge.FileHelper);

                Bridge      = bridge;
                CurrentInst = this;

                CurrentTime = new SAMTime();

                Graphics = new GraphicsDeviceManager(this);
                Content.RootDirectory = "Content";

                CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
                CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
            }
            catch (Exception e)
            {
                SAMLog.FatalError("Game::Constructor", e);
            }
        }
Exemple #3
0
 public GDServerAPI(IOperatingSystemBridge b) : base(GDConstants.SERVER_URL, GDConstants.SERVER_SECRET)
 {
     bridge = b;
 }