public virtual void MoveCursorLeft() { if (Network.peerType == NetworkPeerType.Disconnected) { // If it's a local game, update the corresponding character immediately... if (UFE.config.player1Character == null) { this.MoveCursorLeft(1); } else if (UFE.config.player2Character == null && UFE.gameMode != GameMode.StoryMode) { this.MoveCursorLeft(2); } } else { // If it's an online game, find out if the local player is Player1 or Player2... // And only update the selection for the local player... int localPlayer = UFE.GetLocalPlayer(); if (localPlayer == 1 && UFE.config.player1Character == null) { this.MoveCursorLeft(1); } else if (localPlayer == 2 && UFE.config.player2Character == null) { this.MoveCursorLeft(2); } } }
public void TrySelectStage(int stageIndex) { // Check if he was playing online or not... if (!UFE.isConnected) { // If it's a local game, update the corresponding stage immediately... this.OnStageSelectionAllowed(stageIndex); } else { // If it's an online game, we only select the stage if it has been requested by Player 1... // But if player 2 wants to come back to character selection screen, we also allow that... int localPlayer = UFE.GetLocalPlayer(); if (localPlayer == 1 || stageIndex < 0) { UFEController controller = UFE.GetController(localPlayer); // We don't invoke the OnstageSelected() method immediately because we are using the frame-delay // algorithm to keep players synchronized, so we can't invoke the OnstageSelected() method // until the other player has received the message with our choice. controller.GetType().GetMethod( "RequestOptionSelection", BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy, null, new Type[] { typeof(int) }, null ).Invoke(controller, new object[] { stageIndex }); } } }
public virtual void TrySelectCharacter(int characterIndex, int player) { // Check if he was playing online or not... if (!UFE.isConnected) { // If it's a local game, update the corresponding character immediately... this.OnCharacterSelectionAllowed(characterIndex, player); } else { // If it's an online game, find out if the requesting player is the local player // because we will only accept requests for the local player... int localPlayer = UFE.GetLocalPlayer(); if (player == localPlayer) { UFEController controller = UFE.GetController(localPlayer); // We don't invoke the OnCharacterSelected() method immediately because we are using the frame-delay // algorithm to keep players synchronized, so we can't invoke the OnCharacterSelected() method // until the other player has received the message with our choice. controller.GetType().GetMethod( "RequestOptionSelection", BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy, null, new Type[] { typeof(int) }, null ).Invoke(controller, new object[] { characterIndex }); } } }
public void TrySelectCharacter() { // If it's a local game, update the corresponding character immediately... if (!UFE.isConnected) { if (UFE.config.player1Character == null) { this.TrySelectCharacter(this.p1HoverIndex, 1); } else if (UFE.config.player2Character == null) { this.TrySelectCharacter(this.p2HoverIndex, 2); } } else { // If it's an online game, find out if the local player is Player1 or Player2 // and update the selection only for the local player... int localPlayer = UFE.GetLocalPlayer(); if (localPlayer == 1) { this.TrySelectCharacter(this.p1HoverIndex, localPlayer); } else if (localPlayer == 2) { this.TrySelectCharacter(this.p2HoverIndex, localPlayer); } } }
protected virtual void MoveCursor(AbstractInputController controller) { if (!UFE.isConnected) { // If it's a local game, update the corresponding character immediately... if (UFE.config.player1Character == null) { this.MoveCursor(controller, 1); } else if (UFE.config.player2Character == null && UFE.gameMode != GameMode.StoryMode) { this.MoveCursor(controller, 2); } } else { // If it's an online game, find out if the local player is Player1 or Player2... // And only update the selection for the local player... int localPlayer = UFE.GetLocalPlayer(); if (localPlayer == 1 && UFE.config.player1Character == null) { this.MoveCursor(controller, 1); } else if (localPlayer == 2 && UFE.config.player2Character == null) { this.MoveCursor(controller, 2); } } }
protected virtual void TrySelectOption(int option, int player) { // Check if he was playing online or not... if (!UFE.isConnected) { // If it's a local game, go to the selected screen immediately... this.SelectOption(option, player); } else { // If it's an online game, we need to inform the other client about the screen we want to go... int localPlayer = UFE.GetLocalPlayer(); if (localPlayer == player) { UFEController controller = UFE.GetController(localPlayer); // We don't invoke the OnstageSelected() method immediately because we are using the frame-delay // algorithm to keep players synchronized, so we can't invoke the OnstageSelected() method // until the other player has received the message with our choice. controller.GetType().GetMethod( "RequestOptionSelection", BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy, null, new Type[] { typeof(int) }, null ).Invoke(controller, new object[] { option }); } } }
// Input logger IEnumerator InputLog(string input, string player) { // Record for the player who pressed the key KeyData data = new KeyData(UFE.GetTimer(), input, player, null); string write_to = Constants.addLogUrl + data.AsUrlParams() + "&hash=" + data.Md5Sum(Constants.notSoSecretKey); Debug.Log(write_to); // Enqueue for POSTing to server if (UFE.GetLocalPlayer() == 1) { PostDataToServer.postQueueP1.Add(new WWW(write_to)); } else { PostDataToServer.postQueueP2.Add(new WWW(write_to)); } yield return(null); }
public void TryDeselectCharacter() { if (!UFE.isConnected) { // If it's a local game, update the corresponding character immediately... if (UFE.config.player2Character != null && UFE.gameMode != GameMode.StoryMode && !UFE.GetCPU(2)) { this.TryDeselectCharacter(2); } else { this.TryDeselectCharacter(1); } } else { // If it's an online game, find out if the local player is Player1 or Player2 // and update the selection only for the local player... this.TryDeselectCharacter(UFE.GetLocalPlayer()); } }
public void TrySelectCharacter(int characterIndex) { if (!UFE.isConnected) { // If it's a local game, update the corresponding character immediately... if (UFE.config.player1Character == null) { this.TrySelectCharacter(characterIndex, 1); } else if (UFE.config.player2Character == null && UFE.gameMode != GameMode.StoryMode) { this.TrySelectCharacter(characterIndex, 2); } } else { // If it's an online game, find out if the local player is Player1 or Player2 // and update the selection only for the local player... this.TrySelectCharacter(characterIndex, UFE.GetLocalPlayer()); } }
protected virtual void TrySelectOption(int option, int player) { // Check if he was playing online or not... if (!UFE.isConnected) { // If it's a local game, go to the selected screen immediately... this.SelectOption(option, player); } else { // If it's an online game, we need to inform the other client about the screen we want to go... int localPlayer = UFE.GetLocalPlayer(); if (localPlayer == player) { // We don't invoke the SelectOption() method immediately because we are using the frame-delay // algorithm to keep players synchronized, so we can't invoke the SelectOption() method // until the other player has received the message with our choice. UFE.fluxCapacitor.RequestOptionSelection(player, (sbyte)option); } } }
public void TrySelectStage(int stageIndex) { // Check if he was playing online or not... if (!UFE.isConnected) { // If it's a local game, update the corresponding stage immediately... this.OnStageSelectionAllowed(stageIndex); } else { // If it's an online game, we only select the stage if it has been requested by Player 1... // But if player 2 wants to come back to character selection screen, we also allow that... int localPlayer = UFE.GetLocalPlayer(); if (localPlayer == 1 || stageIndex < 0) { // We don't invoke the OnstageSelected() method immediately because we are using the frame-delay // algorithm to keep players synchronized, so we can't invoke the OnstageSelected() method // until the other player has received the message with our choice. UFE.fluxCapacitor.RequestOptionSelection(localPlayer, (sbyte)stageIndex); } } }
public virtual void TrySelectCharacter(int characterIndex, int player) { // Check if he was playing online or not... if (!UFE.isConnected) { // If it's a local game, update the corresponding character immediately... this.OnCharacterSelectionAllowed(characterIndex, player); } else { // If it's an online game, find out if the requesting player is the local player // because we will only accept requests for the local player... int localPlayer = UFE.GetLocalPlayer(); if (player == localPlayer) { // We don't invoke the OnCharacterSelected() method immediately because we are using the frame-delay // algorithm to keep players synchronized, so we can't invoke the OnCharacterSelected() method // until the other player has received the message with our choice. UFE.fluxCapacitor.RequestOptionSelection(localPlayer, (sbyte)characterIndex); } } }
public string DumpBlackBoard(string player = null) { //Debug.Log(player); if (player == null) { if (UFE.GetLocalPlayer() == 1) { StartCoroutine(BlackBoardLog(Constants.p1Key)); } else { StartCoroutine(BlackBoardLog(Constants.p2Key)); } } else { //Debug.Log(player + " is using the correct thing"); StartCoroutine(BlackBoardLog(player)); } // Also output the string that was dumped return(BlackBoardToString()); }
public virtual void RepeatBattle() { this.TrySelectOption((int)VersusModeAfterBattleScreen.Option.RepeatBattle, UFE.GetLocalPlayer()); }
public virtual void GoToStageSelectionScreen() { this.TrySelectOption((int)VersusModeAfterBattleScreen.Option.StageSelectionScreen, UFE.GetLocalPlayer()); }
public virtual void GoToMainMenu() { this.TrySelectOption((int)VersusModeAfterBattleScreen.Option.MainMenu, UFE.GetLocalPlayer()); }
// Happens every round public void OnRoundBegins(int roundNumber) { // Reset the BlackBoard to clear out information from the previous round bb.ClearBlackBoard(); // Reset Distribution if enabled distr.ResetCount(); // Set diagnostics on battle screen GameObject nameObj = GameObject.Find("Name"); if (nameObj != null) { NameHolder name = nameObj.GetComponent <NameHolder>(); if (name != null) { name.setRoundStarted(true); } } // Add information about each player to Blackboard bb.Register(Constants.p1Key, new Dictionary <string, string>() { // Who am I? { Constants.playerName, "" }, // Passives { Constants.indexLifePoints, p1.currentLifePoints.ToString() }, { Constants.indexFavor, Constants.MIN_FAVOR.ToString() }, { Constants.indexRally, Constants.MIN_RALLY.ToString() }, { Constants.indexBalance, Constants.STARTING_BALANCE.ToString() }, // Extra data for conditioning on moves { Constants.lastHitDamage, "0" }, { Constants.lastAttackByPlayer, "" }, { Constants.landedLastAttack, "" }, { Constants.lastEvade, "" }, { Constants.lastEvadeSuccessful, "" }, { Constants.lastAttackByOpponent, "" }, { Constants.opponentLandedLastAttack, "" }, // Extra data for skill tree nodes // Surprise { Surprise.attackCount, "0" }, { Surprise.evadeCount, "0" }, // Distance to opponent { Constants.distToOpponent, Vector3.Distance(UFE.GetPlayer1Controller().transform.position, UFE.GetPlayer2Controller().transform.position).ToString() }, // Match results { Constants.winner, "false" } }); bb.Register(Constants.p2Key, new Dictionary <string, string>() { // Who am I? { Constants.playerName, "" }, // Passives { Constants.indexLifePoints, p2.currentLifePoints.ToString() }, { Constants.indexFavor, Constants.MIN_FAVOR.ToString() }, { Constants.indexRally, Constants.MIN_RALLY.ToString() }, { Constants.indexBalance, Constants.STARTING_BALANCE.ToString() }, // Extra data for conditioning on moves { Constants.lastHitDamage, "0" }, { Constants.lastAttackByPlayer, "" }, { Constants.landedLastAttack, "" }, { Constants.lastEvade, "" }, { Constants.lastEvadeSuccessful, "" }, { Constants.lastAttackByOpponent, "" }, { Constants.opponentLandedLastAttack, "" }, // Extra data for skill tree nodes // Surprise { Surprise.attackCount, "0" }, { Surprise.evadeCount, "0" }, // Distance to opponent { Constants.distToOpponent, Vector3.Distance(UFE.GetPlayer1Controller().transform.position, UFE.GetPlayer2Controller().transform.position).ToString() }, // Match results { Constants.winner, "false" } }); // Save BlackBoard state if (Network.peerType == NetworkPeerType.Disconnected) { bb.UpdateProperty(Constants.p1Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username); bb.DumpBlackBoard(Constants.p2Key); } else { if (UFE.GetLocalPlayer() == 1) { bb.UpdateProperty(Constants.p1Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username); } else { bb.UpdateProperty(Constants.p2Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username); } } }