public static bool SpecialNavigationSystem(
        this UFEScreen screen,
        int player,
        MoveCursorCallback moveCursorCallback = null,
        ActionCallback confirmCallback        = null,
        ActionCallback cancelCallback         = null
        )
    {
        //-------------------------------------------------------------------------------------------------------------
        // Retrieve the controller assigned to specified player
        //-------------------------------------------------------------------------------------------------------------
        AbstractInputController inputController = UFE.GetController(player);

        if (inputController != null && UFE.eventSystem != null && UFE.eventSystem.isActiveAndEnabled)
        {
            return(UFEScreenExtensions.SpecialNavigationSystem(
                       inputController,
                       inputController.GetAxisRaw(inputController.horizontalAxis),
                       inputController.GetAxisRaw(inputController.verticalAxis),
                       inputController.GetButtonDown(inputController.horizontalAxis),
                       inputController.GetButtonDown(inputController.verticalAxis),
                       inputController.GetButtonDown(UFE.config.inputOptions.confirmButton),
                       inputController.GetButtonDown(UFE.config.inputOptions.cancelButton),
                       moveCursorCallback,
                       confirmCallback,
                       cancelCallback
                       ));
        }

        return(false);
    }
Exemple #2
0
    protected virtual void TryConnect()
    {
        // First, we check that we aren't already connected to a client or a server...
        if (!UFE.multiplayerAPI.IsConnected() && !this._connecting)
        {
            MultiplayerAPI.MatchInformation match = null;

            // After that, check if we have found one match with at least one player which isn't already full...
            while (match == null && this._foundServers.Count > 0)
            {
                match = this._foundServers[0];
                this._foundServers.RemoveAt(0);
            }


            if (match != null)
            {
                // In that case, try connecting to that match
                this._connecting = true;

                UFE.multiplayerAPI.OnJoined    += this.OnJoined;
                UFE.multiplayerAPI.OnJoinError += this.OnJoinError;
                UFE.JoinGame(match);
            }
            else
            {
                // Otherwise, return a net a new match
                this.OnLanGameNotFound();
            }
        }
    }
Exemple #3
0
    protected override void OnGamePaused(bool isPaused)
    {
        base.OnGamePaused(isPaused);

        if (this.pauseScreen != null)
        {
            if (isPaused)
            {
                this.pause = (UFEScreen)GameObject.Instantiate(this.pauseScreen);
                this.pause.transform.SetParent(UFE.canvas != null ? UFE.canvas.transform : null, false);
                this.pause.OnShow();
            }
            else if (this.pause != null)
            {
                if (!this.hiding)
                {
                    AudioClip clip = this.GetStageMusic(UFE.config.selectedStage);
                    if (clip != null)
                    {
                        UFE.PlayMusic(clip);
                    }
                }

                this.pause.OnHide();
                GameObject.Destroy(this.pause.gameObject);
            }
        }
    }
    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 });
            }
        }
    }
Exemple #5
0
    protected virtual void OnGameBegin(CharacterInfo player1, CharacterInfo player2, StageOptions stage)
    {
        this.player1.character = player1;
        UFE.updatedLifePoints  = UFE.config.player1Character.currentLifePoints;
//
//		if (UFE.lifepointsCheck == true) {
//			this.player1.targetLife = UFE.updatedLifePoints;
//			this.player1.totalLife = 500.0f;
//		} else {
        this.player1.targetLife = PlayerPrefs.GetFloat("HEALTH");
        this.player1.totalLife  = 500.0f;
//		}
        this.player1.wonRounds = 0;

        this.player2.character  = player2;
        this.player2.targetLife = player2.lifePoints;
        this.player2.totalLife  = player2.lifePoints;
        this.player2.wonRounds  = 0;

        UFE.PlayMusic(stage.music);
        this.isRunning = true;

// making application pause to show popups for buying weapons

        if (IntroScreen.characterValue == 2 || IntroScreen.characterValue == 3 || IntroScreen.characterValue == 4 || IntroScreen.characterValue == 5 || IntroScreen.characterValue <= 13 || IntroScreen.characterValue == 18 || IntroScreen.characterValue == 19 || IntroScreen.characterValue == 20 || IntroScreen.characterValue == 21)
        {
            Invoke("pauseFn", 5f);
        }
        else
        {
        }
    }
Exemple #6
0
 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);
         }
     }
 }
Exemple #7
0
    protected virtual void OnGameEnd(CharacterInfo winner, CharacterInfo loser)
    {
        this.isRunning = false;

        if (UFE.gameMode == GameMode.VersusMode ||
            UFE.gameMode == GameMode.NetworkGame)
        {
            UFE.StartVersusModeAfterBattleScreen();
        }
        else if (UFE.gameMode == GameMode.StoryMode)
        {
            if (winner == this.player1.character)
            {
                UFE.WonStoryModeBattle();
            }
            else
            {
                UFE.StartStoryModeContinueScreen();
            }
        }
        else
        {
            UFE.StartMainMenuScreen();
        }
    }
Exemple #8
0
 public virtual void SetAIDifficulty(AIDifficultySettings difficulty)
 {
     if (difficulty != null)
     {
         UFE.SetAIDifficulty(difficulty.difficultyLevel);
     }
 }
Exemple #9
0
    public override void DoUpdate()
    {
        base.DoUpdate();

        bool battleGUI  = (UFE.battleGUI != null);
        bool gamePaused = UFE.isPaused();

        if (touchInputUI != null)
        {
            if (battleGUI != this.prevBattleGUI)
            {
                touchInputUI.showTouchControls = battleGUI && !gamePaused;
            }
            else if (gamePaused != this.prevGamePaused)
            {
                if (battleGUI)
                {
                    touchInputUI.showTouchControls = !gamePaused;
                }
            }
        }

        this.prevBattleGUI  = battleGUI;
        this.prevGamePaused = gamePaused;
    }
Exemple #10
0
    IEnumerator levelTwoFirstFight()
    {
        yield return(new WaitForSeconds(3f));

        UFE.HideScreen(UFE.currentScreen);
        UFE.StartGame(0f);
    }
 void CheckOver(VideoPlayer vp)
 {
     videoPlayer.loopPointReached -= CheckOver;
     videoPlayer.Stop();
     videoPlayer = null;
     UFE.DelayLocalAction(this.GoToMainMenu, delayAfterSkippingVideo);
 }
Exemple #12
0
 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 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);
            }
        }
    }
Exemple #15
0
    public void videoMethod()
    {
        AudioListener.volume = 0;
        btn = GameObject.FindGameObjectWithTag("CoinsTag");
        btn.GetComponent <Button>().interactable = false;

        if (InternetStatus())
        {
            Vungle.playAd(true, "QuantumLeap");
            Vungle.onAdFinishedEvent += (adFinishedEventArgs) => {
                if (adFinishedEventArgs.IsCompletedView)
                {
                    AudioListener.volume       = 1;
                    UFE.videoCheck             = true;
                    IntroScreen.characterValue = 100;
                    UFE.StartGame(0);
                }
                else
                {
                }
            };
        }
        else
        {
            UFE.tryAgainPopUp(0f);
        }
    }
Exemple #16
0
 protected virtual void ProcessRandomSeedSynchronizedMessage(RandomSeedSynchronizedMessage msg)
 {
     if (this.player == 2 || UFE.config.networkOptions.fakeNetwork)
     {
         UFE.SetSynchronizedRandomSeed(msg.Data);
     }
 }
Exemple #17
0
    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 });
            }
        }
    }
Exemple #18
0
    public override void DoFixedUpdate()
    {
        //-------------------------------------------------------------------------------------------------------------
        // First, store the player positions at the current frame (if they aren't already stored)
        // because we will use them later for synchronization purpose
        //-------------------------------------------------------------------------------------------------------------
        if (this.inputReferences != null && UFE.GetPlayer1Controller().isReady&& UFE.GetPlayer2Controller().isReady)
        {
            ControlsScript p1 = UFE.GetPlayer1ControlsScript();
            ControlsScript p2 = UFE.GetPlayer2ControlsScript();

            if (
                p1 != null &&
                p2 != null &&
                //UFE.currentNetworkFrame % 100 == 0 &&
                !this.gameState.ContainsKey(UFE.currentNetworkFrame)
                )
            {
                //-----------------------------------------------------------------------------------------------------
                // Send a synchronization message every few frames
                //-----------------------------------------------------------------------------------------------------
                GameState state = new GameState(p1.transform.position, p2.transform.position);
                this.gameState[UFE.currentNetworkFrame] = state;
                UFE.multiplayerAPI.SendNetworkMessage(new SynchronizationMessage(this.player, UFE.currentNetworkFrame, state));
                //Debug.LogWarning("Store State: " + state + "\t(Frame = " + UFE.currentNetworkFrame + ")");
            }
        }

        //-------------------------------------------------------------------------------------------------------------
        // Execute the parent's method
        //-------------------------------------------------------------------------------------------------------------
        base.DoFixedUpdate();
    }
Exemple #19
0
    public override void OnShow()
    {
        base.OnShow();
        this.HighlightOption(this.FindFirstSelectable());

        if (this.music != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlayMusic(this.music); }, this.delayBeforePlayingMusic);
        }

        if (this.stopPreviousSoundEffectsOnLoad)
        {
            UFE.StopSounds();
        }

        if (this.onLoadSound != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlaySound(this.onLoadSound); }, this.delayBeforePlayingMusic);
        }

        if (buttonNetwork != null)
        {
            buttonNetwork.interactable = UFE.isNetworkAddonInstalled;
        }

        if (buttonBluetooth != null)
        {
            buttonBluetooth.interactable = UFE.isNetworkAddonInstalled && Application.isMobilePlatform;
        }
    }
Exemple #20
0
    void Start()
    {
        UFE.SetLanguage("English");

        Rect newPixelInset = guiTexture.pixelInset;

        newPixelInset.width  *= ((float)Screen.width / 1280);
        newPixelInset.height *= ((float)Screen.height / 720);
        guiTexture.pixelInset = newPixelInset;

        startButtonRect   = new Rect(0, 0, startButtonStyle.normal.background.width, startButtonStyle.normal.background.height);
        optionsButtonRect = new Rect(0, 0, optionsButtonStyle.normal.background.width, optionsButtonStyle.normal.background.height);
        creditsButtonRect = new Rect(0, 0, creditsButtonStyle.normal.background.width, creditsButtonStyle.normal.background.height);

        startButtonRect   = SetResolution(startButtonRect, 260);
        optionsButtonRect = SetResolution(optionsButtonRect, 180);
        creditsButtonRect = SetResolution(creditsButtonRect, 100);

        /*startButtonRect.width *= ((float)Screen.width/1280);
         * startButtonRect.height *= ((float)Screen.height/720);
         * startButtonRect.x = ((float)Screen.width/2) - (startButtonRect.width/2);
         * startButtonRect.y = Screen.height - (260 * ((float)Screen.height/720));
         *
         * optionsButtonRect.width *= ((float)Screen.width/1280);
         * optionsButtonRect.height *= ((float)Screen.height/720);
         * optionsButtonRect.x = ((float)Screen.width/2) - (optionsButtonRect.width/2);
         * optionsButtonRect.y = Screen.height - (180 * ((float)Screen.height/720));
         *
         * creditsButtonRect.width *= ((float)Screen.width/1280);
         * creditsButtonRect.height *= ((float)Screen.height/720);
         * creditsButtonRect.x = ((float)Screen.width/2) - (creditsButtonRect.width/2);
         * creditsButtonRect.y = Screen.height - (100 * ((float)Screen.height/720));*/
    }
Exemple #21
0
    protected virtual string ProcessMessage(string msg, ControlsScript controlsScript)
    {
        if (msg == UFE.config.selectedLanguage.combo)
        {
            if (this.announcer != null && !this.muteAnnouncer)
            {
                foreach (ComboAnnouncer comboAnnouncer in this.announcer.combos)
                {
                    if (controlsScript.opControlsScript.comboHits >= comboAnnouncer.hits)
                    {
                        UFE.PlaySound(comboAnnouncer.audio);
                        break;
                    }
                }
            }
        }
        else if (msg == UFE.config.selectedLanguage.parry)
        {
            if (this.announcer != null && !this.muteAnnouncer)
            {
                UFE.PlaySound(this.announcer.parry);
            }
            UFE.PlaySound(UFE.config.blockOptions.parrySound);
        }
        else if (msg == UFE.config.selectedLanguage.counterHit)
        {
            if (this.announcer != null && !this.muteAnnouncer)
            {
                UFE.PlaySound(this.announcer.counterHit);
            }
            UFE.PlaySound(UFE.config.counterHitOptions.sound);
        }
        else if (msg == UFE.config.selectedLanguage.firstHit)
        {
            if (this.announcer != null && !this.muteAnnouncer)
            {
                UFE.PlaySound(this.announcer.firstHit);
            }
        }
        else if (msg == UFE.config.selectedLanguage.fight)
        {
            if (this.announcer != null && !this.muteAnnouncer)
            {
                UFE.PlaySound(this.announcer.fight);
            }
        }
        else if (msg == UFE.config.selectedLanguage.ko)
        {
            if (this.announcer != null && !this.muteAnnouncer && this.announcer.ko != null)
            {
                UFE.PlaySound(this.announcer.ko);
            }
        }
        else
        {
            return(this.SetStringValues(msg, null));
        }

        return(this.SetStringValues(msg, controlsScript));
    }
Exemple #22
0
    void Update()
    {
        if (Input.GetAxisRaw(horizontalAxis) == 0)
        {
            axisHeld = false;
        }

        // Select Stage
        if (!axisHeld && UFE.config.selectedStage == null)
        {
            hoverIndex = StageSelect(hoverIndex);

            if (Input.GetButtonDown(UFE.GetInputReference(selectButton, UFE.config.player1_Inputs)) ||
                Input.GetKeyDown(KeyCode.Space) ||
                Input.GetKeyDown(KeyCode.Return))
            {
                UFE.config.selectedStage = UFE.config.stages[hoverIndex];
                if (UFE.config.soundfx)
                {
                    Camera.main.audio.PlayOneShot(selectSound);
                }
                Invoke("StartGame", 1.2f);
                startingGame = true;
            }
        }

        if (Input.GetAxisRaw(horizontalAxis) != 0)
        {
            axisHeld = true;
        }
    }
Exemple #23
0
    public static void MoveCursor(this UFEScreen screen, Vector3 direction, AudioClip moveCursorSound = null)
    {
        GameObject currentGameObject = UFE.eventSystem.currentSelectedGameObject;
        GameObject nextGameObject    = null;

        if (currentGameObject != null && currentGameObject.activeInHierarchy)
        {
            Selectable currentSelectableObject = currentGameObject.GetComponent <Selectable>();

            if (currentSelectableObject != null && currentSelectableObject.IsInteractable())
            {
                Selectable nextSelectableObject = currentSelectableObject.FindSelectable(direction);

                if (nextSelectableObject != null)
                {
                    nextGameObject = nextSelectableObject.gameObject;
                }
            }
        }

        if (nextGameObject == null)
        {
            nextGameObject = screen.FindFirstSelectableGameObject();
        }

        if (currentGameObject != nextGameObject)
        {
            if (moveCursorSound != null)
            {
                UFE.PlaySound(moveCursorSound);
            }
            screen.HighlightOption(nextGameObject);
        }
    }
Exemple #24
0
    protected override void SelectInputType()
    {
        // [DGT]
        // First, look for Control Freak 2 rig with UFE Bridge component...

        InputTouchControllerBridge bridge =
            GameObject.FindObjectOfType <InputTouchControllerBridge>();

        if (bridge != null)
        {
            this.InitializeTouchControllerBridge(bridge);
            return;
        }

        // Then, look for Control Freak 1.x controller...

        else
        {
            Type type = UFE.SearchClass("TouchController");
            UnityEngine.Object touchController = null;

            if ((type != null) && ((touchController = GameObject.FindObjectOfType(type)) != null))
            {
                this.InitializeControlFreakTouchController(touchController);
                return;
            }
        }

        // If nothing found, use standard Input...

        base.SelectInputType();
    }
Exemple #25
0
 void OnGUI()
 {
     if (GUI.Button(backButtonRect, "", backButtonStyle))
     {
         UFE.StartIntro(2);
     }
 }
 public virtual void NextStage()
 {
     if (this.moveCursorSound != null)
     {
         UFE.PlaySound(this.moveCursorSound);
     }
     this.SetHoverIndex((this.stageHoverIndex + 1) % UFE.config.stages.Length);
 }
    public virtual void SelectPlayerVersusCpu()
    {
        Debug.Log("Player vs CPU");
        NameHolder temp = GameObject.Find("Name").GetComponent <NameHolder>();

        temp.setGameMode("playerVsFuzzy");
        UFE.StartPlayerVersusCpu();
    }
 protected virtual void MoveCursor(int characterIndex)
 {
     if (this.moveCursorSound != null)
     {
         UFE.PlaySound(this.moveCursorSound);
     }
     this.stageHoverIndex = characterIndex;
 }
    public virtual void SelectSelfAIvsSelf()
    {
        Debug.Log("Decision vs Decision");
        NameHolder temp = GameObject.Find("Name").GetComponent <NameHolder>();

        temp.setGameMode("decisionVsDecision");
        UFE.StartCpuVersusCpu();
    }
Exemple #30
0
    public void ingnore()
    {
//		UFE.StartGame (0);
        CharacterInfo[] selectableCharacters = UFE.GetVersusModeSelectableCharacters();
        CharacterInfo   character1           = selectableCharacters [6];

        UFE.SetPlayer(1, character1);
        UFE.StartGame(0);
    }