コード例 #1
0
ファイル: Let.cs プロジェクト: tormaroe/mist
        public override Expression Call(Expression expr)
        {
            var bindings = expr.Elements.Second().Elements;
            var tempScope = new Bindings() { ParentScope = Environment.CurrentScope };

            for (int i = 0; i < bindings.Count - 1; i = i + 2)
                tempScope.AddBinding(
                    bindings[i],
                    bindings[i + 1].Evaluate(tempScope));

            return Environment.WithScope(tempScope,
                () => expr.Elements.Skip(2).Evaluate(tempScope));
        }
コード例 #2
0
        /// <summary>
        /// Bindings factory to create a list of bindings for Bindings object
        /// </summary>
        /// <returns></returns>
        public Bindings CreateBindings()
        {
            Bindings bindings = new Bindings();

            // Note: There is an existing duplication of the exit keybind, but doing so allows for manual arrangement of keybinds
            // without the need of sorting it with algorithm. This allows for much more intuitive order of actions
            // to be displayed on the UI

            // Main
            bindings.AddBinding("travel", 't', "Travel", false, UIManager.FocusableWindows.MainWindow);
            bindings.AddBinding("inventory", 'i', "Inventory", false, UIManager.FocusableWindows.MainWindow);

            // Travel
            bindings.AddBinding("exit", 'x', "Exit", false, UIManager.FocusableWindows.TravelWindow);

            // Inventory
            bindings.AddBinding("weapons", 'w', "Weapons", false, UIManager.FocusableWindows.InventoryWindow);
            bindings.AddBinding("misc", 'm', "Miscellaneous", false, UIManager.FocusableWindows.InventoryWindow);
            bindings.AddBinding("exit", 'x', "Exit", false, UIManager.FocusableWindows.InventoryWindow);

            return(bindings);
        }