コード例 #1
0
ファイル: Engine.cs プロジェクト: bsimser/CoM
    /**
     * Prompts user to confirm an action, if they agree delegate will be executed.
     * @param action The action to perform if the use clicks "OK"
     * @param text The text to show on the confirmation window
     */
    static public void ConfirmAction(SimpleEvent action, string text)
    {
        var state = new ModalDecisionState("Are you sure?", text);

        state.OnYes += action;
        PushState(state);
    }
コード例 #2
0
ファイル: GuiItemTrash.cs プロジェクト: bsimser/CoM
        public override bool Transact(IDragDrop source)
        {
            if ((source == null) || !(source is GuiItemSlot))
            {
                return(false);
            }

            var modal = new ModalDecisionState("Are you sure?", "Do you want to destroy " + source.DDContent + "?\nThis item will be permanently destroyed.");

            modal.OnNo += delegate {
                // nothing to do.
            };

            modal.OnYes += delegate {
                (source as GuiItemSlot).DataLink.ItemInstance = null;
            };

            Engine.PushState(modal);

            return(false);
        }