Esempio n. 1
0
    private VerbResult Main()
    {
        // ** THE QUEST **
        // **
        // ** An adventure game
        //
        CLS();

        PRINT("Please stand by .... ");
        PRINT("");
        PRINT("");

        state = new GameState();

        PrintIntro();

        CLS();

        VerbRoutines verbRoutines = new VerbRoutines(UnknownVerb);

        InitHandlers(verbRoutines);

        while (true)
        {
            PrintDescription();

            PrintDirections();

            PrintObjects();

            while (true)
            {
                string cmd = "";
                do
                {
                    PRINT("");
                    cmd = (INPUT_s("WHAT NOW"));
                }while (cmd == "");

                Command command = Command.Parse(cmd);

                VerbResult ret = verbRoutines.Handle(command.Verb, command.Noun);
                if (ret == VerbResult.Idle)
                {
                    // NO-OP
                }
                else if (ret == VerbResult.Proceed)
                {
                    break;
                }
                else
                {
                    return(ret);
                }
            }
        }
    }
Esempio n. 2
0
        public override VerbResult Start(EditableView.ClickPosition position)
        {
            base.AddLink(null, 0);
            base.AddLink(null, 0);
            VerbResult result = base.Start(position);

            UpdateLink(0, position);           // but we deliberately leave the other one floating; otherwise it would just point to the same socket
            m_Acceptable      = false;
            m_DefinedVertices = 2;             // not used by this class and confuses base class
            return(result);
        }
Esempio n. 3
0
        public override VerbResult CombinedKey(Keys key, char ch, Page page, bool simulated, EditableView fromView)
        {
            // ignore the key if we don't have a cursor (otherwise this shape will swallow all sorts of functional keys (e.g. shape selection) whenever it is selected)
            if (!HasCaret)
            {
                return(VerbResult.Unexpected);
            }
            if (!m_BaseLineFixed)
            {
                Utilities.LogSubError("TextLine has caret without base line fixed");
                return(VerbResult.Unexpected);
            }
            VerbResult result = base.CombinedKey(key, ch, page, simulated, fromView);

            if (ch != '\0')
            {
                m_Bounds = CalculateBounds();
                if (m_LastPromptWasEmpty != string.IsNullOrEmpty(m_Label))
                {
                    Parent.NotifyIndirectChange(this, ChangeAffects.UpdatePrompts);
                }
            }
            return(result);
        }