Example #1
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;
        }
    }
 void CheckOver(VideoPlayer vp)
 {
     videoPlayer.loopPointReached -= CheckOver;
     videoPlayer.Stop();
     videoPlayer = null;
     UFE.DelayLocalAction(this.GoToMainMenu, delayAfterSkippingVideo);
 }
Example #3
0
 public void Update()
 {
     if ((skippable && Input.anyKeyDown) || videoPlayer.frame >= (long)videoPlayer.frameCount)
     {
         videoPlayer.Stop();
         videoPlayer = null;
         UFE.DelayLocalAction(this.GoToNextScreen, (Fix64)delayAfterSkippingVideo);
     }
 }
Example #4
0
    public override void OnShow()
    {
        base.OnShow();

        this.transform.parent        = null;
        this.transform.localPosition = Vector3.zero;
        this.transform.localRotation = Quaternion.identity;
        this.transform.localScale    = Vector3.one;
        UFE.DelayLocalAction(LoadMovie, (Fix64)delayBeforePlayingVideo);
    }
Example #5
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.onLoadSound != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlaySound(this.onLoadSound); }, this.delayBeforePlayingMusic);
        }
    }
    public override void OnShow()
    {
        base.OnShow();

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

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

        UFE.DelaySynchronizedAction(this.GoToNextScreen, this.delayBeforeLoadingNextScreen);
    }
    public override void OnShow()
    {
        base.OnShow();

        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);
        }
    }
Example #8
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.onLoadSound != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlaySound(this.onLoadSound); }, this.delayBeforePlayingMusic);
        }

        if (myInfoText != null)
        {
            myInfoText.text = "IP: " + GetIp() + "\nPort: " + UFE.config.networkOptions.port;
        }
    }
    public override void OnShow()
    {
        base.OnShow();
        this.visible = true;

        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 (this.musicToggle != null)
        {
            this.musicToggle.isOn = UFE.config.music;
        }

        if (this.musicSlider != null)
        {
            this.musicSlider.value = UFE.config.musicVolume;
        }

        if (this.soundToggle != null)
        {
            this.soundToggle.isOn = UFE.config.soundfx;
        }

        if (this.soundSlider != null)
        {
            this.soundSlider.value = UFE.config.soundfxVolume;
        }

        int difficultySettingsLength    = UFE.config.aiOptions.difficultySettings.Length;
        AIDifficultySettings difficulty = UFE.GetAIDifficulty();

        if (this.difficultySlider != null)
        {
            this.difficultySlider.minValue     = 0;
            this.difficultySlider.maxValue     = difficultySettingsLength - 1;
            this.difficultySlider.wholeNumbers = true;
            this.difficultySlider.value        = this.GetDifficultyIndex(difficulty);
        }

        if (this.difficultyName != null)
        {
            this.difficultyName.text = difficulty.difficultyLevel.ToString();
        }

        if (this.aiEngineName != null)
        {
            AIEngine aiEngine = UFE.GetAIEngine();

            if (aiEngine == AIEngine.RandomAI)
            {
                this.aiEngineName.text = "Random";
            }
            else
            {
                this.aiEngineName.text = "Fuzzy";
            }
        }

        if (this.debugModeToggle != null)
        {
            this.debugModeToggle.isOn = UFE.config.debugOptions.debugMode;
        }

        if (this.diagnosticModeToggle != null)
        {
            GameObject nameObj = GameObject.Find("Name");
            if (nameObj != null)
            {
                NameHolder name = nameObj.GetComponent <NameHolder>();
                if (name != null)
                {
                    this.diagnosticModeToggle.isOn = name.diagnosticMode;
                }
                else
                {
                    Debug.Log("Could not find nameholder script");
                }
            }
            else
            {
                Debug.Log("Could not find name object");
            }
        }
        if (this.changeControlsButton != null)
        {
            this.changeControlsButton.gameObject.SetActive(
                UFE.isCInputInstalled && UFE.config.inputOptions.inputManagerType == InputManagerType.cInput
                );
        }

        this.HighlightOption(this.FindFirstSelectable());
    }
    public override void OnShow()
    {
        base.OnShow();

        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 (UFE.config.player1Character != null)
        {
            if (this.portraitPlayer1 != null)
            {
                this.portraitPlayer1.sprite = Sprite.Create(
                    UFE.config.player1Character.profilePictureBig,
                    new Rect(0f, 0f, UFE.config.player1Character.profilePictureBig.width, UFE.config.player1Character.profilePictureBig.height),
                    new Vector2(0.5f * UFE.config.player1Character.profilePictureBig.width, 0.5f * UFE.config.player1Character.profilePictureBig.height)
                    );
            }

            if (this.namePlayer1 != null)
            {
                this.namePlayer1.text = UFE.config.player1Character.characterName;
            }
        }

        if (UFE.config.player2Character != null)
        {
            if (this.portraitPlayer2 != null)
            {
                this.portraitPlayer2.sprite = Sprite.Create(
                    UFE.config.player2Character.profilePictureBig,
                    new Rect(0f, 0f, UFE.config.player2Character.profilePictureBig.width, UFE.config.player2Character.profilePictureBig.height),
                    new Vector2(0.5f * UFE.config.player2Character.profilePictureBig.width, 0.5f * UFE.config.player2Character.profilePictureBig.height)
                    );
            }

            if (this.namePlayer2 != null)
            {
                this.namePlayer2.text = UFE.config.player2Character.characterName;
            }
        }

        this.stageHoverIndex = 0;
        StageOptions stage = UFE.config.stages[this.stageHoverIndex];

        if (stage != null)
        {
            if (this.screenshotStage != null)
            {
                this.screenshotStage.sprite = Sprite.Create(
                    stage.screenshot,
                    new Rect(0f, 0f, stage.screenshot.width, stage.screenshot.height),
                    new Vector2(0.5f * stage.screenshot.width, 0.5f * stage.screenshot.height)
                    );
            }

            if (this.nameStage != null)
            {
                this.nameStage.text = stage.stageName;
            }
        }
    }
    public override void OnShow()
    {
        base.OnShow();

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

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

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

        if (UFE.config.player1Character != null)
        {
            if (this.portraitPlayer1 != null)
            {
                this.portraitPlayer1.sprite = Sprite.Create(
                    UFE.config.player1Character.profilePictureBig,
                    new Rect(0f, 0f, UFE.config.player1Character.profilePictureBig.width, UFE.config.player1Character.profilePictureBig.height),
                    new Vector2(0.5f * UFE.config.player1Character.profilePictureBig.width, 0.5f * UFE.config.player1Character.profilePictureBig.height)
                    );
            }

            if (this.namePlayer1 != null)
            {
                this.namePlayer1.text = UFE.config.player1Character.characterName;
            }
        }

        if (UFE.config.player2Character != null)
        {
            if (this.portraitPlayer2 != null)
            {
                this.portraitPlayer2.sprite = Sprite.Create(
                    UFE.config.player2Character.profilePictureBig,
                    new Rect(0f, 0f, UFE.config.player2Character.profilePictureBig.width, UFE.config.player2Character.profilePictureBig.height),
                    new Vector2(0.5f * UFE.config.player2Character.profilePictureBig.width, 0.5f * UFE.config.player2Character.profilePictureBig.height)
                    );
            }

            if (this.namePlayer2 != null)
            {
                this.namePlayer2.text = UFE.config.player2Character.characterName;
            }
        }

        if (UFE.config.selectedStage != null)
        {
            if (this.screenshotStage != null)
            {
                this.screenshotStage.sprite = Sprite.Create(
                    UFE.config.selectedStage.screenshot,
                    new Rect(0f, 0f, UFE.config.selectedStage.screenshot.width, UFE.config.selectedStage.screenshot.height),
                    new Vector2(0.5f * UFE.config.selectedStage.screenshot.width, 0.5f * UFE.config.selectedStage.screenshot.height)
                    );

                Animator anim = this.screenshotStage.GetComponent <Animator>();
                if (anim != null)
                {
                    anim.enabled = UFE.gameMode != GameMode.StoryMode;
                }
            }

            /*if (this.nameStage != null){
             *      this.nameStage.text = UFE.config.selectedStage.stageName;
             * }*/
        }

        UFE.DelaySynchronizedAction(UFE.PreloadBattle, this.delayBeforePreload);

        UFE.DelaySynchronizedAction(this.StartBattle, this.delayBeforePreload + UFE.config.preloadingTime + this.delayAfterPreload);
    }
Example #12
0
    public override void OnShow()
    {
        // We add these lines before base.OnShow() because they will affect how will the engine display
        // characters selected by default
        Camera.main.transform.position    = UFE.config.cameraOptions.initialDistance;
        Camera.main.transform.eulerAngles = UFE.config.cameraOptions.initialRotation;
        Camera.main.fieldOfView           = UFE.config.cameraOptions.initialFieldOfView;
        if (this.displayMode == DisplayMode.CharacterGameObject)
        {
            if (background3dPrefab != null)
            {
                this.background = GameObject.Instantiate(background3dPrefab);
            }

            UFE.canvas.planeDistance = 0.1f;
            UFE.canvas.worldCamera   = Camera.main;
            UFE.canvas.renderMode    = RenderMode.ScreenSpaceCamera;
        }

        base.OnShow();
        this.characterButtonsWhiteList.Clear();

        // Set the portraits of the characters
        if (this.characters != null)
        {
            // First, update the portraits of the characters until we run out of characters or portrait slots....
            for (int i = 0; i < this.selectableCharacters.Length && i < this.characters.Length; ++i)
            {
                Image         character           = this.characters[i];
                CharacterInfo selectableCharacter = this.selectableCharacters[i];

                if (character != null)
                {
                    character.gameObject.SetActive(true);
                    character.sprite = Sprite.Create(
                        selectableCharacter.profilePictureSmall,
                        new Rect(0f, 0f, selectableCharacter.profilePictureSmall.width, selectableCharacter.profilePictureSmall.height),
                        new Vector2(0.5f * selectableCharacter.profilePictureSmall.width, 0.5f * selectableCharacter.profilePictureSmall.height)
                        );

                    Button button = character.GetComponent <Button>();
                    if (button == null)
                    {
                        button = character.gameObject.AddComponent <Button>();
                    }

                    int index = i;
                    button.onClick.AddListener(() => { this.TrySelectCharacter(index); });
                    button.targetGraphic = character;
                    this.characterButtonsWhiteList.Add(button);
                }
            }

            // If there are more slots than characters, fill the remaining slots with the "No Character" sprite...
            // If the "No Character" sprite is undefined, hide the image instead.
            for (int i = this.selectableCharacters.Length; i < this.characters.Length; ++i)
            {
                Image character = this.characters[i];
                if (character != null)
                {
                    if (this.noCharacterSprite != null)
                    {
                        this.characters[i].gameObject.SetActive(true);
                        this.characters[i].sprite = this.noCharacterSprite;
                    }
                    else
                    {
                        this.characters[i].gameObject.SetActive(false);
                    }
                }
            }
        }

        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);
        }

        this.SetHoverIndex(1, Mathf.Clamp(this.defaultCharacterPlayer1, 0, this.selectableCharacters.Length - 1));
        if (UFE.gameMode == GameMode.StoryMode)
        {
            if (this.namePlayer2 != null)
            {
                this.namePlayer2.text = "???";
            }

            if (this.portraitPlayer2 != null)
            {
                this.portraitPlayer2.gameObject.SetActive(false);
            }

            this.UpdateHud();
        }
        else
        {
            this.SetHoverIndex(2, Mathf.Clamp(this.defaultCharacterPlayer2, 0, this.selectableCharacters.Length - 1));

            if (this.portraitPlayer2 != null)
            {
                this.portraitPlayer2.gameObject.SetActive(true);
            }
        }
    }
Example #13
0
    public override void OnShow()
    {
        // Set the portraits of the characters
        if (this.characters != null)
        {
            // First, update the portraits of the characters until we run out of characters or portrait slots....
            CharacterInfo[] selectableCharacters = this.GetSelectableCharacters();
            for (int i = 0; i < selectableCharacters.Length && i < this.characters.Length; ++i)
            {
                this.characters[i].gameObject.SetActive(true);
                this.characters[i].sprite = Sprite.Create(
                    selectableCharacters[i].profilePictureSmall,
                    new Rect(0f, 0f, selectableCharacters[i].profilePictureSmall.width, selectableCharacters[i].profilePictureSmall.height),
                    new Vector2(0.5f * selectableCharacters[i].profilePictureSmall.width, 0.5f * selectableCharacters[i].profilePictureSmall.height)
                    );
            }

            // If there are more slots than characters, fill the remaining slots with the "No Character" sprite...
            // If the "No Character" sprite is undefined, hide the image instead.
            for (int i = selectableCharacters.Length; i < this.characters.Length; ++i)
            {
                if (this.noCharacterSprite != null)
                {
                    this.characters[i].gameObject.SetActive(true);
                    this.characters[i].sprite = this.noCharacterSprite;
                }
                else
                {
                    this.characters[i].gameObject.SetActive(false);
                }
            }
        }

        base.OnShow();

        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 (UFE.gameMode == GameMode.StoryMode)
        {
            if (this.namePlayer2 != null)
            {
                this.namePlayer2.text = "???";
            }

            if (this.portraitPlayer2 != null)
            {
                this.portraitPlayer2.gameObject.SetActive(false);
            }

            this.UpdateHud();
        }
        else
        {
            this.SetHoverIndex(2, Mathf.Min(this.GetHoverIndex(2), this.charactersPerRow - 1));

            if (this.portraitPlayer2 != null)
            {
                this.portraitPlayer2.gameObject.SetActive(true);
            }
        }
    }
Example #14
0
    protected virtual void OnMatchesDiscovered(ReadOnlyCollection <MultiplayerAPI.MatchInformation> matches)
    {
        int unique = 0;

        if (matches != null)
        {
            for (int i = 0; i < matches.Count; ++i)
            {
                if (matches[i] != null)
                {
                    bool duplicate = false;
                    for (int f = 0; f < _foundMatches.Count; f++)
                    {
                        if (_foundMatches[f].unityNetworkId == matches[i].unityNetworkId)
                        {
                            duplicate = true;
                        }
                    }
                    for (int t = 0; t < _triedMatches.Count; t++)
                    {
                        if (_triedMatches[t].unityNetworkId == matches[i].unityNetworkId)
                        {
                            duplicate = true;
                        }
                    }

                    if (UFE.config.networkOptions.networkService == NetworkService.Photon)
                    {
                        duplicate = false;
                    }


                    if (duplicate)
                    {
                        if (UFE.config.networkOptions.networkService == NetworkService.Unity)
                        {
                            if (UFE.config.debugOptions.connectionLog)
                            {
                                Debug.Log("Match Found: " + matches[i].unityNetworkId + " [duplicate]");
                            }
                        }
                        else
                        {
                            if (UFE.config.debugOptions.connectionLog)
                            {
                                Debug.Log("Match Found: " + matches[i].matchName + " [duplicate]");
                            }
                        }
                    }
                    else
                    {
                        if (UFE.config.networkOptions.networkService == NetworkService.Unity)
                        {
                            if (UFE.config.debugOptions.connectionLog)
                            {
                                Debug.Log("Match Found: " + matches[i].unityNetworkId);
                            }
                        }
                        else
                        {
                            if (UFE.config.debugOptions.connectionLog)
                            {
                                Debug.Log("Match Found: " + matches[i].matchName);
                            }
                        }

                        this._foundMatches.Add(matches[i]);
                        unique++;
                    }
                }
            }
            if (UFE.config.debugOptions.connectionLog)
            {
                Debug.Log("Matches Found (available/total): " + unique + "/" + matches.Count);
            }
        }

        if (unique > 0 || _currentSearchTime >= maxSearchTimes)
        {
            this.TryConnect();
        }
        else
        {
            UFE.DelayLocalAction(StartSearchingGames, searchDelay);
            _currentSearchTime++;
        }
        this.StopSearchingMatchGames(false);
    }