Esempio n. 1
0
        private void InitialiseValues()
        {
            // A lot of things are initialised by the World static class (see the Engine namespace)

            // The UI needs to know what an action is if it's a nonstandard action.
            // report hiOwner is a reporting action used in debugging

            // Create player
            _player = World._player;

            // Define actions
            _Report_hiOwner = World._Report_hiOwner;

            // UI - put the beginning text in, and get the UI ready for use

            if ((World._BeginningText != "") && (World._BeginningText != null))
            {
                richTextBox1.AppendText(World._BeginningText + "\n");
            }
            _player.DetermineActions(ref ActionList);
            UpdateUIAfterTurn();
        }
Esempio n. 2
0
        private void UpdateUIAfterTurn()
        {
            string s = "";

            // If in normal mode, display the usual controls, while hiding Conversation control.
            // If in conversation / branching actions mode, hide most of them and display
            // the Conversation control.
            // Used to manually resize Action listbox.  Interesting to note that the widths
            // in the form designer were 282 and 862, but here I needed to use 2/3 those values,
            // so 189 and 576.

            if (_player.CurrentConversation != null)
            {
                /*
                 * lbAction.Visible = false;
                 * lbInventory.Visible = false;
                 * lblInventory.Visible = false;
                 * lbLocInv.Visible = false;
                 * lblObjects.Visible = false;
                 * lbDirections.Visible = false;
                 * lblDirections.Visible = false;
                 * lbConversation.Visible = true;
                 */
                pnlConversation.Visible = true;
                pnlNormalMode.Visible   = false;
                // Conversation Dialogue responses are done here.  If the turn just gone
                // initiated a conversation, we want the first line of Dialogue to be
                // output straight away, with no further clicks needed.

                if (_player.CurrentConversation.AtBeginning())
                {
                    _player.CurrentConversation.GetDialogue(ref s);
                    if (s != "")
                    {
                        richTextBox1.AppendText(s);
                    }

                    richTextBox1.AppendText("\n> ");
                }

                _player.CurrentConversation.DetermineResponses(ref ResponseList);
                lbConversation.DataSource = null;
                lbConversation.DataSource = ResponseList;
            }
            else
            {
                /*
                 * lbAction.Visible = true;
                 * lbAction.Enabled = true;
                 * lbInventory.Visible = true;
                 * lbInventory.Enabled = true;
                 * lblInventory.Visible = true;
                 * lbLocInv.Visible = true;
                 * lbLocInv.Enabled = true;
                 * lblObjects.Visible = true;
                 * lbDirections.Visible = true;
                 * lbDirections.Enabled = true;
                 * lblDirections.Visible = true;
                 * lbConversation.Visible = false;
                 * */
                pnlConversation.Visible = false;
                pnlNormalMode.Visible   = true;
                lbAction.Enabled        = true;
                lbInventory.Enabled     = true;
                lbLocInv.Enabled        = true;
                lbDirections.Enabled    = true;

                button1.Text = "Do Action";

                _player.DetermineActions(ref ActionList);
                lbAction.DataSource = null;
                lbAction.DataSource = ActionList;
            }

            if (_player.CurrentTextSequence != null)
            {
                pnlConversation.Visible = false;
                pnlNormalMode.Visible   = true;
                lbAction.Enabled        = false;
                lbInventory.Enabled     = false;
                lbLocInv.Enabled        = false;
                lbDirections.Enabled    = false;

                /*
                 * lbAction.Enabled = false;
                 * lbInventory.Enabled = false;
                 * lbLocInv.Enabled = false;
                 * lbDirections.Enabled = false; */
                button1.Text = "Next";

                _player.DetermineActions(ref ActionList);
                lbAction.DataSource = null;
                lbAction.DataSource = ActionList;

                // The very beginning of a text sequence gets kicked off here.
                // This is to make sure that if the turn just gone
                // Text Sequences are otherwise handled in button1_click.
                if (_player.CurrentTextSequence.AtBeginning())
                {
                    s = _player.CurrentTextSequence.Current() + "\n---\n\n";
                    richTextBox1.AppendText(s);
                }
            }

            // Clear Selection in Conversations and Actions lists
            lbAction.ClearSelected();
            lbConversation.ClearSelected();

            // Determine and display player Inventory
            _player.DetermineDisplayList(ref FinalPlayerInv);
            lbInventory.DataSource = null;
            lbInventory.DataSource = FinalPlayerInv;
            lbInventory.ClearSelected();

            // Determine and display Location inventory
            _player.CurrentLocation.DetermineDisplayList(ref FinalLocInv);
            lbLocInv.DataSource = null;
            lbLocInv.DataSource = FinalLocInv;
            lbLocInv.ClearSelected();

            // Determine and display directions
            DetermineDirections();

            // If finished, disable all listboxes and the
            // action button
            if (_player.sState == "Finished")
            {
                lbAction.Enabled       = false;
                lbInventory.Enabled    = false;
                lbLocInv.Enabled       = false;
                lbDirections.Enabled   = false;
                lbConversation.Enabled = false;
            }

            // Diagnostics

            /*
             * richTextBox1.AppendText("In public: ");
             * foreach(Location l in World.InPublic.LocationList)
             * {
             *  richTextBox1.AppendText(l.sName + " ");
             * }
             * richTextBox1.AppendText("\n");
             * richTextBox1.AppendText("In apartment: ");
             * foreach (Location l in World.InApartment.LocationList)
             * {
             *  richTextBox1.AppendText(l.sName + " ");
             * }
             *
             * richTextBox1.AppendText("\n");
             * richTextBox1.AppendText("In all apartment: ");
             * foreach (Location l in World.InAllApartment.LocationList)
             * {
             *  richTextBox1.AppendText(l.sName + " ");
             * }
             * richTextBox1.AppendText("\n");
             */

            // Various other bits
            rtbCommandLine.Text = "";
            i            = null;
            i2           = null;
            NumOfObjs    = 0;
            ProtoCmdLine = "";

            //Location box
            rtbLocation.Text = _player.CurrentLocation.sName + "\n";
            rtbLocation.AppendText(_player.CurrentLocation.sDescription + "\n");

            s = _player.CurrentLocation.BlockedExits();
            if (s != "")
            {
                s += "\n";
            }
            rtbLocation.AppendText(s);

            s = _player.CurrentLocation.LockedExits();
            rtbLocation.AppendText(s);

            // Diagnosis box
            rtbDiagnosis.Text = _player.getDiagnosis();
        }