public static void PushSaveFilesSubState(OnSaveFilePressedDelegate in_delegate) { GStateManager stateManager = GStateManager.Instance; stateManager.OnSubStateChange += onLoadGenericDialog; s_delegate = in_delegate; stateManager.PushSubState(STATE_NAME); }
IEnumerator transferScene() { yield return(YieldFactory.GetWaitForFixedUpdate()); GStateManager stateManager = GStateManager.Instance; stateManager.ChangeState(GameState.STATE_NAME); stateManager.PopSubState(_stateInfo); }
private static void onPushConnectingSubStateLoaded(BaseState in_state) { GStateManager stateMgr = GStateManager.Instance; if (in_state as ConnectingSubState) { stateMgr.OnInitializeDelegate -= onPushConnectingSubStateLoaded; ((ConnectingSubState)in_state).Init(ms_instructionText, ms_buttonText, ms_canCancel); } }
public static void PushConnectingSubState(string in_instructionText, string in_buttonText, bool in_canCancel = true) { GStateManager stateMgr = GStateManager.Instance; stateMgr.OnInitializeDelegate += onPushConnectingSubStateLoaded; ms_instructionText = in_instructionText; ms_buttonText = in_buttonText; ms_canCancel = in_canCancel; stateMgr.PushSubState(STATE_NAME); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here //GSoundManager.LoadContent(Content); GSpriteFactory.getInstance().Init(Content); GStateManager.getInstance().Content = Content; GStateManager.getInstance().AddState(new GIntroState(eGStateGame.INTRO)); }
protected override void OnEnter() { GStateManager stateMgr = GStateManager.Instance; stateMgr.RetrieveInitializedDelegates(this); stateMgr.OnEnterNewSubState(_stateInfo); if (OnInitializeDelegate != null) { OnInitializeDelegate(this); } }
private static void onPushJoiningGameSubStateFindLobbyLoaded(BaseState in_state) { GStateManager stateMgr = GStateManager.Instance; if (in_state as JoiningGameSubState) { stateMgr.OnInitializeDelegate -= onPushJoiningGameSubStateFindLobbyLoaded; BombersNetworkManager networkMgr = BombersNetworkManager.singleton as BombersNetworkManager; networkMgr.FindLobby(gmatchOptions); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); // TODO: Add your drawing code here spriteBatch.Begin(); GStateManager.getInstance().Render(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
/// <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) { // Allows the game to exit if (GGlobalSetting.IsExit == true) { this.Exit(); } // TODO: Add your update logic here Input.Update(); GStateManager.getInstance().Update(gameTime); GStateManager.getInstance().HandleInput(gameTime, Input); base.Update(gameTime); }
public static void PushGenericDialog(string in_sTitle, string in_sDescription, string in_sLeftButtonText = "Okay", UnityAction in_LeftButtonDelegate = null, string in_sRightButtonText = "Cancel", UnityAction in_RightButtonDelegate = null) { GStateManager stateManager = GStateManager.Instance; stateManager.OnSubStateChange += onLoadGenericDialog; s_sTitle = in_sTitle; s_sDescription = in_sDescription; s_sLeftButtonText = in_sLeftButtonText; s_sRightButtonText = in_sRightButtonText; s_LeftButtonDelegate = in_LeftButtonDelegate; s_RightButtonDelegate = in_RightButtonDelegate; stateManager.PushSubState(STATE_NAME); }
void CreateNewRoom(string aName, uint size, Dictionary <string, object> matchAttributes) { BombersNetworkManager networkMgr = BombersNetworkManager.singleton as BombersNetworkManager; //List<MatchInfoSnapshot> rooms = null;// networkMgr.matches; bool roomExists = false; string roomName = aName; if (aName == "") { roomName = GPlayerMgr.Instance.PlayerData.PlayerName + "'s Room"; } if (roomExists) { //m_dialogueDisplay.DisplayDialog("There's already a room named " + aName + "!"); return; } int playerLevel = BrainCloudStats.Instance.GetStats()[0].Value; if (m_roomLevelRangeMin < 0) { m_roomLevelRangeMin = 0; } else if (m_roomLevelRangeMin > playerLevel) { m_roomLevelRangeMin = playerLevel; } if (m_roomLevelRangeMax > 50) { m_roomLevelRangeMax = 50; } if (m_roomLevelRangeMax < m_roomLevelRangeMin) { m_roomLevelRangeMax = m_roomLevelRangeMin; } if (size > 8) { size = 8; } else if (size < 2) { size = 2; } matchAttributes["minLevel"] = m_roomLevelRangeMin; matchAttributes["maxLevel"] = m_roomLevelRangeMax; matchAttributes["StartGameTime"] = m_gameDurations[m_gameDurationListSelection].Duration; matchAttributes["IsPlaying"] = 0; matchAttributes["MapLayout"] = m_layoutListSelection; matchAttributes["MapSize"] = m_sizeListSelection; GCore.Wrapper.Client.EntityService.UpdateSingleton("gameName", "{\"gameName\": \"" + roomName + "\"}", null, -1, null, null, null); BrainCloudStats.Instance.ReadStatistics(); Dictionary <string, object> matchOptions = new Dictionary <string, object>(); matchOptions.Add("gameTime", matchAttributes["StartGameTime"]); matchOptions.Add("gameTimeSel", m_gameDurationListSelection); matchOptions.Add("isPlaying", 0); matchOptions.Add("mapLayout", m_layoutListSelection); matchOptions.Add("mapSize", m_sizeListSelection); matchOptions.Add("gameName", roomName); matchOptions.Add("maxPlayers", size); matchOptions.Add("lightPosition", 0); matchOptions.Add("minLevel", m_roomLevelRangeMin); matchOptions.Add("maxLevel", m_roomLevelRangeMax); switch (m_state) { case eCreateGameState.NEW_ROOM: default: { // Make sure that the JoiningGameSubState is loaded before calling CreateLobby GStateManager stateMgr = GStateManager.Instance; stateMgr.OnInitializeDelegate += onPushJoiningGameSubStateCreateLobbyLoaded; gmatchOptions = matchOptions; stateMgr.PushSubState(JoiningGameSubState.STATE_NAME); } break; case eCreateGameState.QUICK_PLAY: case eCreateGameState.FIND_ROOM: { // Make sure that the JoiningGameSubState is loaded before calling FindLobby GStateManager stateMgr = GStateManager.Instance; stateMgr.OnInitializeDelegate += onPushJoiningGameSubStateFindLobbyLoaded; gmatchOptions = matchOptions; stateMgr.PushSubState(JoiningGameSubState.STATE_NAME); } break; } }