public override void Initialize() { //Subscribe to the game object added and removed events. gameObjectManager = GameServiceManager.GetService <IGameObjectManager>(); gameObjectManager.OnGameObjectAdded += OnGameObjectAdded; gameObjectManager.OnGameObjectRemoved += OnGameObjectRemovedHandler; }
public override void Initialize() { //Grab a reference to the IInputHandler service. InputHandler = GameServiceManager.GetService <IInputHandler>(); base.Initialize(); }
void OnGetUserInfoComplated(string userInfo) { string systemName = Application.platform.ToString(); Debug.Log("接到sdk返回的数据:" + userInfo); GameServiceManager.Service <EAccount>("AccountService/PlatformLogin", this, "OnLoginServerBack", userInfo + "|" + systemName); }
public static void Main(string[] args) { // create server socket handler var server = GameServiceManager.RegisterService(new NetworkServer(27015, 20)); // create chat system handler var chatSystem = GameServiceManager.RegisterService(new ServerChatManager()); // start logging and network server service GameServiceManager.StartServices(); Thread server_thread = new Thread(UpdateServer); server_thread.Start(); Console.WriteLine("type quit and press enter to exit"); while (true) { String input = Console.ReadLine(); if (input == "exit" || input == "quit") { lock (close_server) { close_server = true; break; } } } // shutdown properly and exit GameServiceManager.Shutdown(); }
public void JoinLocalGame() { GameServiceManager.RegisterService(new ConfigHandler()); GameServiceManager.RegisterService(new NetworkClient()); GameServiceManager.RegisterService(new ChatClient(this, ChannelList, ChannelPrefab, UserList)); GameServiceManager.StartServices(); }
public void ReportScore() { if (!GameServiceManager.IsInitialized()) { MobileNativeUI.Alert("Alert", "You need to initialize the module first."); return; } if (selectedLeaderboard == null) { MobileNativeUI.Alert("Alert", "Please select a leaderboard to report score to."); } else { if (string.IsNullOrEmpty(scoreInput.text)) { MobileNativeUI.Alert("Alert", "Please enter a score to report."); } else { int score = System.Convert.ToInt32(scoreInput.text); GameServiceManager.ReportScore(score, selectedLeaderboard.Name); MobileNativeUI.Alert("Alert", "Reported score " + score + " to leaderboard \"" + selectedLeaderboard.Name + "\"."); } } }
protected override void Initialize() { _logger.LogInformation("Init"); _serviceContainer.RegisterInstance(this); _serviceContainer.RegisterInstance(GraphicsDevice); _serviceContainer.RegisterInstance(graphics); _serviceContainer.RegisterInstance <ILoggerFactory>(_logFactory); _serviceContainer.Register(typeof(ILogger <>), typeof(Logger <>)); _serviceContainer.RegisterSingleton(typeof(IAllocator), typeof(HeapAllocator)); _serviceContainer.RegisterSingleton(typeof(EntityManager), typeof(EntityManager)); _serviceContainer.RegisterSingleton(typeof(IEventManager), typeof(EventManager)); _serviceContainer.RegisterSingleton(typeof(IAutoEventManager), typeof(AutoEventManager)); _services = new GameServiceManager(typeof(Engine).Assembly, _serviceContainer, _logFactory); _serviceContainer.Verify(); _services.Initialize(); Reload(); _geeReloadTask = Task.Run(() => CheckGEE()); base.Initialize(); Window.AllowUserResizing = true; Window.IsBorderless = true; Window.AllowAltF4 = true; }
public override void Initialize() { randomGenerator = GameServiceManager.GetService <IRandomGenerator>(); ResetTimer(); base.Initialize(); }
// Use this for initialization void Start() { _adsManager = GetComponent <AdsManager>(); _settingsManager = GetComponent <SettingsManager>(); _collectibleManager = GetComponent <CollectibleManager>(); _state = GameState.MainMenu; GUI_mainMenu.gameObject.SetActive(true); GUI_inGame.gameObject.SetActive(false); _camera = Camera.main.GetComponent <CameraFollow> (); _spawnPosition = _camera.transform.position; _spawnPosition.y -= Camera.main.orthographicSize - _playerYOffset; _spawnPosition.z = 0; _adsManager.CreateAdBanner(); for (int i = 0; i < destructors.Length; i++) { destructors [i].Reset += OnReset; } _gameServiceManager = GetComponent <GameServiceManager>(); _gameServiceManager.Init(); _gameServiceManager.SignIn(); GameSettings.sensitivity = PlayerPrefs.GetFloat(Constants.SETTINGS_SENSITIVITY, 1); }
public override void Initialize() { CameraManager = GameServiceManager.GetService <ICameraService>(); ParentGameObject.OnMove += OnMove; base.Initialize(); }
void OnUserAuthenticated() { if (!disable) { // Load current scores on leaderboards GameServiceManager.LoadLocalUserScore(leaderboardName, OnLeaderboardScoreLoaded); } }
public override void PostInitialize() { gameObjectFactory = GameServiceManager.GetService <IGameObjectFactory>(); LoadLevel("testLevel"); base.PostInitialize(); }
void Start() { EventListener.Get(BtnGold.gameObject).onClick = ShopGoldEvent; EventListener.Get(BtnDem.gameObject).onClick = ShopDemEvent; EventListener.Get(BtnVIP.gameObject).onClick = ShopVIPEvent; EventListener.Get(BtnBag.gameObject).onClick = ShopBagEvent; GameServiceManager.Service <List <EStore> >("StoreService/AllProps", this, "AllPropsCallBack", Session.UserID); }
public override void Initialize() { ComponentFactory = (IComponentFactory)GameServiceManager.GetService(typeof(IComponentFactory)); rawPool = new PoolNew <IGameObject>(typeof(GameObject), 1024); gameObjectTemplates = new Dictionary <string, IGameObject>(); }
void OnRecordPlayClicked(GameObject sender) { int id = System.Convert.ToInt32(sender.transform.parent.gameObject.name.Split('_')[1]); GameServiceManager.Service <EBattleRecord>("BattleService/GetBattleRecord", this, "GetBattleRecordCallBack", id); //EBattleRecord record = RecordList.FirstOrDefault(); SoundManager.Instance.PlaySound("音效/按钮"); App.Instance.DataLoading.Show(); }
public GameServiceManager() { if (GameServiceManager.Instance != null) { throw new Exception("singleton has already been created"); } GameServiceManager.Instance = this; }
public void LoadFriends() { if (!GameServiceManager.IsInitialized()) { MobileNativeUI.Alert("Alert", "You need to initialize the module first."); return; } GameServiceManager.LoadFriends(OnFriendsLoaded); }
void OnBtnSureClicked(GameObject sender) { if (string.IsNullOrEmpty(IptFriendID.text)) { App.Instance.HintBox.Show("请填写好友ID"); return; } SoundManager.Instance.PlaySound("音效/按钮"); GameServiceManager.Service <int>("AccountService/AddFriends", this, "AddFriendsBack", Session.UserID, IptFriendID.text); }
public override void PostInitialize() { var goManager = GameServiceManager.GetService <IGameObjectManager>(); goManager.OnGameObjectAdded += OnGameObjectAdded; player = goManager.FindWithMetadata("player"); base.PostInitialize(); }
public override void Initialize() { var gameObjectManager = GameServiceManager.GetService <IGameObjectManager>(); if (gameObjectManager != null) { gameObjectManager.OnGameObjectAdded += OnGameObjectAdded; } ResumeSimulation(); }
public void Init() { if (GameServiceManager.IsInitialized()) { MobileNativeUI.Alert("Alert", "The module is already initialized."); } else { GameServiceManager.Init(); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { var manager = (PlayerManager)GameServiceManager.GetService(typeof(PlayerManager)); manager.SetPlayer(LogicalPlayerIndex.One, PlayerIndex.One); foreach (var service in GameServiceManager.Services) { service.PostInitialize(); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } GameServiceManager.Update(gameTime); base.Update(gameTime); }
public override void Initialize() { var gameObjectManager = GameServiceManager.GetService <IGameObjectManager>(); if (gameObjectManager != null) { gameObjectManager.OnGameObjectAdded += OnGameObjectAddedHandler; } PhysicsWorld.BodyRemoved += OnBodyRemoved; }
public void Initialize() { var factory = GameServiceManager.GetService <IGameObjectManager>(); if (factory != null) { factory.OnGameObjectAdded += OnGameObjectAdded; factory.OnGameObjectRemoved += OnGameObjectRemoved; } BodyRemoved += OnBodyRemoved; }
public override void Update(GameTime gameTime) { var gameObjects = GameServiceManager.GetService <IGameObjectManager>().GetAll(); foreach (var gameObject in gameObjects) { if (gameObject.Active) { gameObject.Update(gameTime); } } }
public override void Initialize() { //Tell the collision manager we want to subscribe... IPhysicsManager collisionManager = GameServiceManager.GetService <IPhysicsManager>(); if (collisionManager != null) { collisionManager.SubscribeCollisionEvent(this.ParentGameObject.GUID, OnCollision); } base.Initialize(); }
public override void Deserialize(XElement element) { IEnumerable <XElement> behaviorElements = element.Element("behaviors").Elements("behavior"); behaviorFactory = GameServiceManager.GetService <IBehaviorFactory>(); foreach (var behaviorElement in behaviorElements) { var behavior = behaviorFactory.LoadBehaviorFromXML(behaviorElement); AddBehavior(behavior); } }
public override void Deserialize(XElement element) { //Read in all of our renderables. if (element.Element("renderables") != null) { RenderableFactory factory = (RenderableFactory)GameServiceManager.GetService(typeof(RenderableFactory)); if (factory != null) { renderables = factory.GenerateRenderables(element.Element("renderables"), this); } } }
public override void Initialize() { foreach (var behavior in behaviors) { behavior.Value.Initialize(); } actionManager = GameServiceManager.GetService <IActionManager>(); ActionFactory = GameServiceManager.GetService <IActionFactory>(); behaviorFactory = GameServiceManager.GetService <IBehaviorFactory>(); base.Initialize(); }