private void TryAddPlayer()
        {
            if (string.IsNullOrWhiteSpace(PlayerName))
            {
                SetTextBoxDesign();
                Message = "Du måste skriva något.";
                return;
            }

            else if (PlayerName.Contains(" "))
            {
                SetTextBoxDesign();
                Message = "Ditt namn får inte innehålla mellanslag";
                return;
            }

            if (_module.TryAddPlayer(PlayerName, out _))
            {
                SetActivePlayer(PlayerName);
                MessageBox.Show($"Välkommen {ActivePlayerName}! Du är nu en medlem!");
                GoToPage(ApplicationPage.GamePage);
                return;
            }

            else
            {
                SetTextBoxDesign();
                Message = "Du har valt ett namn som är upptaget - försök igen";
            }
        }
    public string DoubtMsg()
    {
        if (PlayerName.Contains("Player1"))
        {
            avatar.sprite = characterSprite[1];
        }
        if (PlayerName.Contains("Player2"))
        {
            avatar.sprite = characterSprite[2];
        }
        if (PlayerName.Contains("Player3"))
        {
            avatar.sprite = characterSprite[1];
        }
        if (PlayerName.Contains("Player4"))
        {
            avatar.sprite = characterSprite[1];
        }
        switch (Random.Range(0, 1))
        {
        case 0: return("Doubt!");

        default: return("...");
        }
    }
    public string DoubtResponseMsg()
    {
        if (PlayerName.Contains("Player1"))
        {
            avatar.sprite = characterSprite[8];
        }
        if (PlayerName.Contains("Player2"))
        {
            avatar.sprite = characterSprite[9];
        }
        if (PlayerName.Contains("Player3"))
        {
            avatar.sprite = characterSprite[8];
        }
        if (PlayerName.Contains("Player4"))
        {
            avatar.sprite = characterSprite[8];
        }
        switch (Random.Range(0, 5))
        {
        case 0: return("!!!");

        case 1: return("Gah!");

        case 2: return("Erk!");

        case 3: return("Nyuu~?");

        case 4: return("Can't be helped...");

        default: return("...");
        }
    }
    public string WinFailMsg()
    {
        if (PlayerName.Contains("Player1"))
        {
            avatar.sprite = characterSprite[16];
        }
        if (PlayerName.Contains("Player2"))
        {
            avatar.sprite = characterSprite[13];
        }
        if (PlayerName.Contains("Player3"))
        {
            avatar.sprite = characterSprite[15];
        }
        if (PlayerName.Contains("Player4"))
        {
            avatar.sprite = characterSprite[14];
        }
        switch (Random.Range(0, 5))
        {
        case 0: return("Why can't I win...");

        case 1: return("Nuuuu!");

        case 2: return("Waaaa...");

        case 3: return("Nyauu~~!!!");

        case 4: return("N-Next time!");

        default: return("...");
        }
    }
    public string DoubtDodgeFailMsg()
    {
        if (PlayerName.Contains("Player1"))
        {
            avatar.sprite = characterSprite[Random.Range(9, 13)];
        }
        if (PlayerName.Contains("Player2"))
        {
            avatar.sprite = characterSprite[Random.Range(10, 13)];
        }
        if (PlayerName.Contains("Player3"))
        {
            avatar.sprite = characterSprite[Random.Range(9, 11)];
        }
        if (PlayerName.Contains("Player4"))
        {
            avatar.sprite = characterSprite[Random.Range(9, 12)];
        }
        switch (Random.Range(0, 5))
        {
        case 0: return("NOOOO!!!");

        case 1: return("Ugh...");

        case 2: return("Ooh... nooo....");

        case 3: return("Waaaah~~!!");

        case 4: return("RIP, me.");

        default: return("...");
        }
    }
    public string DoubtDodgeSuccessMsg()
    {
        if (PlayerName.Contains("Player1"))
        {
            avatar.sprite = characterSprite[4];
        }
        if (PlayerName.Contains("Player2"))
        {
            avatar.sprite = characterSprite[7];
        }
        if (PlayerName.Contains("Player3"))
        {
            avatar.sprite = characterSprite[5];
        }
        if (PlayerName.Contains("Player4"))
        {
            avatar.sprite = characterSprite[7];
        }
        switch (Random.Range(0, 5))
        {
        case 0: return("Huehuehue~~");

        case 1: return("I got you!");

        case 2: return("Oh no you don't.");

        case 3: return("Dadada~~~");

        case 4: return("Here's your present~!!");

        default: return("Take this!");
        }
    }
    public string DoubtFailMsg()
    {
        if (PlayerName.Contains("Player1"))
        {
            avatar.sprite = characterSprite[Random.Range(9, 13)];
        }
        if (PlayerName.Contains("Player2"))
        {
            avatar.sprite = characterSprite[Random.Range(10, 13)];
        }
        if (PlayerName.Contains("Player3"))
        {
            avatar.sprite = characterSprite[Random.Range(9, 11)];
        }
        if (PlayerName.Contains("Player4"))
        {
            avatar.sprite = characterSprite[Random.Range(9, 12)];
        }
        switch (Random.Range(0, 5))
        {
        case 0: return("Noooo!!!");

        case 1: return("L-Lucky shot!");

        case 2: return("Such... trick...");

        case 3: return("Ouch!");

        case 4: return("Goodbye, world...");

        default: return("...");
        }
    }
    public string DoubtSuccessMsg()
    {
        if (PlayerName.Contains("Player1"))
        {
            avatar.sprite = characterSprite[4];
        }
        if (PlayerName.Contains("Player2"))
        {
            avatar.sprite = characterSprite[7];
        }
        if (PlayerName.Contains("Player3"))
        {
            avatar.sprite = characterSprite[5];
        }
        if (PlayerName.Contains("Player4"))
        {
            avatar.sprite = characterSprite[7];
        }
        switch (Random.Range(0, 5))
        {
        case 0: return("Mwahaha~~!!");

        case 1: return("So obvious.");

        case 2: return("You can't fool me!");

        case 3: return("Phew, close call.");

        case 4: return("Dundundun~~");

        default: return("Yay, I got it right!");
        }
    }
    void Start()
    {
        string playerButton = PlayerName + "ButtonDoubt";

        if (playerButton.Contains("Player1"))
        {
            Button btnDoubt = GameObject.Find(playerButton).GetComponent <Button>();
            btnDoubt.onClick.AddListener(delegate { Doubt(); });
        }
        canCallDoubt      = false;
        isPlayDiceRolled  = false;
        isDoubtDiceRolled = false;

        GameObject.Find(PlayerName + "Name").GetComponent <Text>().text = RealName;

        if (PlayerName.Contains("Player1"))
        {
            characterSprite = Resources.LoadAll <Sprite>("neptune_sprite");
        }
        if (PlayerName.Contains("Player2"))
        {
            characterSprite = Resources.LoadAll <Sprite>("noire_sprite");
        }
        if (PlayerName.Contains("Player3"))
        {
            characterSprite = Resources.LoadAll <Sprite>("blanc_sprite");
        }
        if (PlayerName.Contains("Player4"))
        {
            characterSprite = Resources.LoadAll <Sprite>("vert_sprite");
        }
    }
示例#10
0
        private void PlayerNameScreen()
        {
            //Get screen handle
            RootConsole rootConsole = RootConsole.GetInstance();

            //Clear screen
            rootConsole.Clear();

            rootConsole.ForegroundColor = ColorPresets.Khaki;

            //Draw frame
            //Why xpos 2 here?
            rootConsole.DrawFrame(1, 4, Screen.Instance.Width - 2, Screen.Instance.Height - 9, true);

            //Draw preample
            preambleTL = new Point(5, 7);

            rootConsole.ForegroundColor = ColorPresets.MediumSeaGreen;

            int           height;
            List <string> preamble = new List <string>();

            preamble.Add("Welcome to TraumaRL v" + Game.Version + "! post-7DRL 2014");
            preamble.Add("flend & shroomarts");
            preamble.Add("");
            preamble.AddRange(Utility.LoadTextFile("introPreamble", Screen.Instance.Width - 2 * preambleTL.x, out height));

            for (int i = 0; i < preamble.Count; i++)
            {
                rootConsole.PrintLineRect(preamble[i], preambleTL.x, preambleTL.y + i, Screen.Instance.Width - 2 * preambleTL.x, 1, LineAlignment.Left);
            }

            int   nameYCoord = 5 + preamble.Count + 2;
            Point nameIntro  = new Point(5, nameYCoord);

            do
            {
                PlayerName = Screen.Instance.GetUserString("Name: Private ", nameIntro, 20);
                LogFile.Log.LogEntry("Player name: " + PlayerName);
            } while(PlayerName.Contains(" ") || PlayerName == "");

            //Check if this save game exists. If so we can exit now and the game will be loaded

            /*
             * if (Utility.DoesSaveGameExist(PlayerName))
             * {
             *  return;
             * }*/

            //Settings text
            int   settingsYCoord = nameYCoord + 2;
            Point settingsTL     = new Point(5, settingsYCoord);

            List <string> settingsText = Utility.LoadTextFile("introSettings", Screen.Instance.Width - 2 * preambleTL.x, out height);

            for (int i = 0; i < settingsText.Count; i++)
            {
                rootConsole.PrintLineRect(settingsText[i], settingsTL.x, settingsTL.y + i, Screen.Instance.Width - 2 * settingsTL.x, 1, LineAlignment.Left);
            }

            //Ask settings questions
            ShowMovies = Screen.Instance.YesNoQuestionWithFrame("Show logs on pickup (recommended)", 8, ColorPresets.Khaki, ColorPresets.MediumSeaGreen);

            rootConsole.Flush();

            //Ask settings questions
            Difficulty = Screen.Instance.DifficultyQuestionWithFrame("Game difficulty: (E)asy / (M)edium / (H)ard?", 8, ColorPresets.Khaki, ColorPresets.MediumSeaGreen);

            rootConsole.PrintLineRect("Generating the station...", settingsTL.x, settingsTL.y + settingsText.Count + 5, Screen.Instance.Width - 2 * settingsTL.x, 1, LineAlignment.Left);
        }