Ejemplo n.º 1
0
 public static void notify(ReceivablePacket packet)
 {
     // Used for kicked message.
     NetworkManager.instance.kicked = true;
     // Go to login screen.
     SceneFader.Fade("LoginScreen", Color.white, 0.5f);
 }
Ejemplo n.º 2
0
    private void OnClickDeleteButton()
    {
        // Get current character data.
        CharacterDataHolder characterData = PlayerManager.instance.selectedCharacterData;

        // Return if no character is selected.
        if (characterData == null)
        {
            return;
        }

        // Disable buttons.
        createButton.enabled     = false;
        deleteButton.enabled     = false;
        enterWorldButton.enabled = false;
        exitButton.enabled       = false;

        // Set text message to deleting character.
        textMessage.text = "Deleting character " + characterData.GetName() + "...";

        // Request info.
        waitingServer = true;
        NetworkManager.instance.ChannelSend(new CharacterDeletionRequest(characterData.GetSlot()));

        // Wait until server deletes the character.
        while (waitingServer)
        {
            // Make sure server has deleted the character.
        }

        // Reload everything.
        Destroy(characterSelected); // Destroy clone object.
        SceneFader.Fade("CharacterSelection", Color.white, 0.5f);
    }
Ejemplo n.º 3
0
    void Start()
    {
        rigidBodies = FindObjectsOfType <Rigidbody2D>();
        switched    = false;
        fader       = GetComponent <SceneFader>();

        fadeScreen.SetActive(true);
        StartCoroutine(fader.Fade(SceneFader.FadeDirection.Out));
    }
Ejemplo n.º 4
0
 public void ChannelSend(SendablePacket packet)
 {
     if (SocketConnected())
     {
         socket.Send(Encryption.Encrypt(packet.GetSendableBytes()));
     }
     else // Connection closed.
     {
         DisconnectFromServer();
         // Go to login screen.
         SceneFader.Fade("LoginScreen", Color.white, 0.5f);
     }
 }
Ejemplo n.º 5
0
 private void OnClickEnterButton()
 {
     // Check if no character exists.
     if (PlayerManager.instance.selectedCharacterData == null)
     {
         textMessage.text = "You must create a character.";
     }
     else // Enter world.
     {
         Destroy(characterSelected); // Destroy clone object.
         SceneFader.Fade("World", Color.white, 0.5f);
     }
 }
Ejemplo n.º 6
0
    protected override async void dialogue()
    {
        await this.wait(2);

        await this.showContinue("Child", "Dad, what happened to grandpa? Why can't he be around us anymore");

        await this.showContinue("Dad", "Hmmmm.... I'm not sure if you're old enough to hear about the story about grandpa..");

        await this.showContinue("Child", "I promise I'm old enough to hear about it dad! I'm a big boy now!");

        await this.showContinue("Dad", "Alright then... well... it began like this");

        end();
        fader.Fade();
    }
Ejemplo n.º 7
0
 protected override void Update()
 {
     if (FlaiInput.IsNewKeyPress(this.LoadFirstSceneKey))
     {
         SceneFader.Fade(SceneDescription.FromIndex(0), Fade.Create(0.75f), Fade.Create(0.75f));
     }
     else if (FlaiInput.IsNewKeyPress(this.ReloadSceneKey))
     {
         SceneFader.Fade(SceneDescription.FromIndex(Application.loadedLevel), Fade.Create(0.15f), Fade.Create(0.15f));
     }
     else if (FlaiInput.IsNewKeyPress(this.PreviousSceneKey))
     {
         SceneFader.Fade(SceneDescription.FromIndex(Application.loadedLevel - 1), Fade.Create(0.15f), Fade.Create(0.15f));
     }
     else if (FlaiInput.IsNewKeyPress(this.NextSceneKey))
     {
         SceneFader.Fade(SceneDescription.FromIndex((Application.loadedLevel == Application.levelCount - 1) ? 0 : Application.loadedLevel + 1), Fade.Create(0.15f), Fade.Create(0.15f));
     }
 }
Ejemplo n.º 8
0
    private void OnClickTask()
    {
        // Disable buttons.
        DisableButtons();

        // Store login information.
        string account  = accountNameField.text;
        string password = passwordField.text;

        // Input field checks.
        if (account == "")
        {
            messageText.text = "Please enter your account name.";
            EnableButtons();
            return;
        }
        if (password == "")
        {
            messageText.text = "Please enter your password.";
            EnableButtons();
            return;
        }
        if (account.Length < 2)
        {
            messageText.text = "Account name length is too short.";
            EnableButtons();
            return;
        }
        if (password.Length < 2)
        {
            messageText.text = "Password length is too short.";
            EnableButtons();
            return;
        }

        // Try to connect to server.
        if (!NetworkManager.instance.ConnectToServer())
        {
            messageText.text = "Could not communicate with the server.";
            EnableButtons();
            return;
        }

        // Authenticate.
        messageText.text = "Authenticating...";
        status           = -1;
        NetworkManager.instance.ChannelSend(new AccountAuthenticationRequest(account, password));

        // Wait for result.
        authenticating = true;
        while (authenticating)
        {
            switch (status)
            {
            case 0:
                messageText.text = "Account does not exist.";
                authenticating   = false;
                break;

            case 1:
                messageText.text = "Account is banned.";
                authenticating   = false;
                break;

            case 2:
                messageText.text = "Account requires activation.";
                authenticating   = false;
                break;

            case 3:
                messageText.text = "Wrong password.";
                authenticating   = false;
                break;

            case 4:
                messageText.text = "Account is already connected.";
                authenticating   = false;
                break;

            case 5:
                messageText.text = "Too many online players, please try again later.";
                authenticating   = false;
                break;

            case 100:
                messageText.text = "Authenticated.";
                authenticating   = false;
                break;
            }
        }

        // Go to player selection screen.
        if (status == 100)
        {
            PlayerManager.instance.accountName = account;
            SceneFader.Fade("CharacterSelection", Color.white, 0.5f);
        }
        else // Enable buttons.
        {
            NetworkManager.instance.DisconnectFromServer();
            EnableButtons();
        }
    }
Ejemplo n.º 9
0
 private void OnClickCreateButton()
 {
     Destroy(characterSelected); // Destroy clone object.
     SceneFader.Fade("CharacterCreation", Color.white, 0.5f);
 }
Ejemplo n.º 10
0
    // Start is called before the first frame update

    public void Retry()
    {
        m_SceneFader.Fade(SceneManager.GetActiveScene().name);
        //        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); //현재씬을 재시작 하기위함으로 현재씬 인덱스 다시 로드
    }
Ejemplo n.º 11
0
 public void Play()
 {
     m_SceneFader.Fade(m_sLoadString);
 }
Ejemplo n.º 12
0
 public void QuitBuutonClick()
 {
     m_SceneFader.Fade(m_sMainMenuName);
 }
Ejemplo n.º 13
0
 public void LevelSelect(string sLevelName)
 {
     m_SceneFacder.Fade(sLevelName);
 }
Ejemplo n.º 14
0
 // Use this for initialization
 protected virtual void Start()
 {
     SC_Game.Instance.StartLevel();
     StartCoroutine(SceneFader.Fade(Color.black, Color.clear, _startDuration));
 }
Ejemplo n.º 15
0
 public void Continue()
 {
     PlayerPrefs.SetInt("LevelReach", m_nLevelToUnlock);
     m_SceneFader.Fade(m_sNextLevel);
 }
Ejemplo n.º 16
0
    public IEnumerator TransitionToScene(string toScene, Color fromColor, Color toColor, float duration)
    {
        yield return(StartCoroutine(SceneFader.Fade(fromColor, toColor, duration)));

        yield return(SceneManager.LoadSceneAsync(toScene));
    }
Ejemplo n.º 17
0
    public void Retry()
    {
        Toggle();
        m_SceneFader.Fade(SceneManager.GetActiveScene().name);
//        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
Ejemplo n.º 18
0
 // Use this for initialization
 protected virtual void Start()
 {
     StartCoroutine(SceneFader.Fade(Color.black, Color.clear, _startDuration));
 }
Ejemplo n.º 19
0
 private void OnClickExitButton()
 {
     Destroy(characterSelected); // Destroy clone object.
     SceneFader.Fade("LoginScreen", Color.white, 0.5f);
 }
    private IEnumerator LoadLevelAfterDelay(float delay)
    {
        yield return(new WaitForSeconds(delay));

        SceneFader.Fade("LoginScreen", Color.black, 0.5f);
    }