Exemplo n.º 1
0
 void Run()
 {
     Singletons.Add <PlayerManager>().Initialize();
     Singletons.Add <SyncManager>().Initialize();
     StartNetwork();
     TSLog.Info("Server Started!");
 }
Exemplo n.º 2
0
 private static void SetSingleton(Type service)
 {
     try
     {
         if (Get(service) == null)
         {
             Singletons.Add(service, Activator.CreateInstance(service));
         }
     }
     catch { }
 }
Exemplo n.º 3
0
 private static void SetSingleton <Service>()
 {
     try
     {
         if (Get <Service>() == null)
         {
             Singletons.Add(typeof(Service), Activator.CreateInstance(typeof(Service)));
         }
     }
     catch { }
 }
Exemplo n.º 4
0
 IEnumerator InitSingletons(params Type[] types)
 {
     foreach (Type type in types)
     {
         try
         {
             mSingletons.Add(Singletons.Add(type));
         }
         catch (Exception e)
         {
             DestroySingletons();
             GameLog.Exception(e);
         }
     }
     yield break;
 }
Exemplo n.º 5
0
        void Run()
        {
            updaterate       = AppConfig.Instance.updaterate;
            tickrate         = AppConfig.Instance.tickrate;
            cmdrate          = AppConfig.Instance.cmdrate;
            snapshotOverTick = (uint)Mathf.FloorToInt(updaterate / tickrate);

            Singletons.Add <InputManager>();
            Singletons.Add <SyncManagerClient>();
            Singletons.Add <PlayerManagerClient>();

            netlayer   = new UdpConnector();
            mGameState = new GameState.Init();

            Time.fixedDeltaTime = tickrate;
            mGameState.Start();
        }
Exemplo n.º 6
0
 protected override void PrepareForLoad()
 {
     Conventions.AddRange(new MugenConvetion[] { new ServiceConvention(Injector), new ViewModelConvention(Injector) });
     Singletons.Add <IEventAggregator, EventAggregator>();
     Singletons.Add <IErrorDialogViewModel, ErrorDialogViewModel>(true);
     Singletons.Add <IShellViewModel, ShellViewModel>(true);
     Singletons.Add <IPlaybackViewModel, PlaybackViewModel>(true);
     Singletons.Add <IFullScreenVideoPlaybackViewModel, FullScreenVideoPlaybackViewModel>();
     Singletons.Add <IEmbeddedVideoPlaybackViewModel, EmbeddedVideoPlaybackViewModel>();
     Singletons.Add <ISnappedVideoPlaybackViewModel, SnappedVideoPlaybackViewModel>();
     Singletons.Add <IDefaultBottomBarViewModel, DefaultBottomBarViewModel>();
     Singletons.Add <IPlaybackBottomBarViewModel, PlaybackBottomBarViewModel>();
     Singletons.Add <IPlaylistBottomBarViewModel, PlaylistBottomBarViewModel>();
     Singletons.Add <IManagePlaylistsViewModel, ManagePlaylistsViewModel>(true);
     Singletons.Add <ISavePlaylistViewModel, SavePlaylistViewModel>(true);
     Singletons.Add <ISettingsHelper, SettingsHelper>();
     Singletons.Add <INotificationsHelper, NotificationsHelper>();
     Singletons.Add <IConfigurationProvider, LastFmConfigurationProvider>();
     Singletons.Add <SubEchoNest.IConfigurationProvider, EchoNestConfigurationProvider>();
 }
Exemplo n.º 7
0
    IEnumerator AwakeRoutine()
    {
        FlatBuffersInitializer.Initialize(typeof(ProtocolInitializer).Assembly);
        MessageBuilder.Initialize();
        yield return(StartCoroutine(InitializeLog()));

        AppConfig appConfig = Singletons.Add <AppConfig>("Config/config.json");

        yield return(StartCoroutine(appConfig.Initialize()));

        Singletons.Add <CoexEngine>();

        if (!isHeadless)
        {
            UI.Instance.Show <SceneList>();
        }
        else
        {
            string   scene = null;
            string[] args  = Environment.GetCommandLineArgs();
            for (int i = 0; i < args.Length; ++i)
            {
                if (args[i] == "--scene" && i < args.Length - 1)
                {
                    scene = args[i + 1];
                    break;
                }
            }

            if (null != scene)
            {
                UnityEngine.SceneManagement.SceneManager.LoadScene(scene);
            }
            else
            {
                GameLog.Error("specify scene on command line, eg. --scene PacMan");
                Application.Quit();
            }
        }
    }
 private bool TerminateRange(bool inRange, uint rangeStart, uint i)
 {
     if (rangeStart == i - 1)
     {
         Singletons.Add((char)rangeStart);
         orderedData.Add(new SwitchPair <char, RangeSet>((char)rangeStart));
     }
     else if (rangeStart == i - 2)
     {
         Singletons.Add((char)rangeStart);
         Singletons.Add((char)(rangeStart + 1));
         orderedData.Add(new SwitchPair <char, RangeSet>((char)(rangeStart)));
         orderedData.Add(new SwitchPair <char, RangeSet>((char)(rangeStart + 1)));
     }
     else if (inRange)
     {
         Sets.Add(new RangeSet((char)rangeStart, (char)(i - 1)));
         orderedData.Add(new SwitchPair <char, RangeSet>(new RangeSet((char)rangeStart, (char)(i - 1))));
     }
     inRange = false;
     return(inRange);
 }
 private void handleChanged(TECChangedEventArgs obj)
 {
     if (obj.Sender is TECBid && obj.Value is TECTypical typ)
     {
         if (obj.Change == Change.Add)
         {
             if (typ.Instances.Count != 1)
             {
                 TypicalSystems.Add(typ);
             }
             else
             {
                 Singletons.Add(typ);
             }
         }
         else if (obj.Change == Change.Remove)
         {
             TypicalSystems.Remove(typ);
             Singletons.Remove(typ);
         }
     }
     else if (obj.Sender is TECTypical typParent && obj.Value is TECSystem)
     {
         if (typParent.Instances.Count == 1)
         {
             TypicalSystems.Remove(typParent);
             Singletons.Add(typParent);
         }
         else
         {
             Singletons.Remove(typParent);
             if (!TypicalSystems.Contains(typParent))
             {
                 TypicalSystems.Add(typParent);
             }
         }
     }
 }
Exemplo n.º 10
0
        public static void Initialize()
        {
            Game game = Singletons.Add <Game>();

            game.Run();
        }
Exemplo n.º 11
0
        public static void Initialize()
        {
            Server server = Singletons.Add <Server>();

            server.Run();
        }
Exemplo n.º 12
0
 protected override void PrepareForLoad()
 {
     Singletons.Add <IHtmlTransformService, HtmlTransformService>();
 }