Beispiel #1
0
    public void SelectAddOp(bool test = true)
    {
        QuestData.Event.VarOperation op = new QuestData.Event.VarOperation();
        op.var       = varESL.selection;
        op.operation = "=";
        if (test)
        {
            op.operation = ">";
        }
        op.value = "0";

        if (op.var.Equals("{NEW}"))
        {
            varText = new QuestEditorTextEdit("Var Name:", "", delegate { NewVar(op, test); });
            varText.EditText();
        }
        else
        {
            if (test)
            {
                eventComponent.conditions.Add(op);
            }
            else
            {
                eventComponent.operations.Add(op);
            }
            Update();
        }
    }
Beispiel #2
0
    // Open a dialog to rename this component
    public void Rename()
    {
        string name = component.sectionName.Substring(component.typeDynamic.Length);

        rename = new QuestEditorTextEdit("Component Name:", name, delegate { RenameFinished(); });
        rename.EditText();
    }
Beispiel #3
0
 public void SelectAddFlag(string type)
 {
     if (flagsESL.selection.Equals("{NEW}"))
     {
         newFlagText = new QuestEditorTextEdit("Flag Name:", "", delegate { NewFlag(type); });
         newFlagText.EditText();
     }
     else
     {
         SelectAddFlag(type, flagsESL.selection);
     }
 }
Beispiel #4
0
 public void SelectSource(string source)
 {
     if (source.Equals("{NEW:File}"))
     {
         sourceFileText = new QuestEditorTextEdit(new StringKey("val", "FILE"), "", delegate { NewSource(); });
         sourceFileText.EditText();
     }
     else
     {
         SetSource(source);
     }
 }
Beispiel #5
0
 public void SelectQuotaVar(string var)
 {
     if (var.Equals("{NEW}"))
     {
         varText = new QuestEditorTextEdit(VAR_NAME, "", delegate { NewQuotaVar(); });
         varText.EditText();
     }
     else
     {
         eventComponent.quotaVar = var;
         eventComponent.quota    = 0;
         Update();
     }
 }
Beispiel #6
0
    public static void SelectAddOp(string var, ITestable testable, Action updateAction, bool test = true)
    {
        if (var == null)
        {
            updateAction.Invoke();
            return;
        }

        VarTests            tests      = testable.Tests;
        List <VarOperation> operations = testable.Operations;
        VarOperation        op         = new VarOperation();

        op.var       = var;
        op.operation = "=";
        if (test)
        {
            op.operation = ">";
        }
        op.value = "0";

        if (op.var.Equals("{NEW}"))
        {
            // Var name doesn localize
            var textEdit = new QuestEditorTextEdit(CommonStringKeys.VAR_NAME, "", s => NewVar(s, op, test, testable, updateAction));
            textEdit.EditText();
        }
        else
        {
            if (test)
            {
                if (tests.VarTestsComponents.Count == 0)
                {
                    tests.Add(op);
                }
                else
                {
                    tests.Add(new VarTestsLogicalOperator());
                    tests.Add(op);
                }
            }
            else
            {
                operations.Add(op);
            }

            updateAction.Invoke();
        }
    }
Beispiel #7
0
 public void SelectSetValue(VarOperation op, string value)
 {
     if (value.Equals("{NUMBER}"))
     {
         // Vars doesnt localize
         varText = new QuestEditorTextEdit(
             new StringKey("val", "X_COLON", NUMBER),
             "", delegate { SetNumValue(op); });
         varText.EditText();
     }
     else
     {
         op.value = value;
         Update();
     }
 }
Beispiel #8
0
    public void SelectAddOp(string var, bool test = true)
    {
        VarOperation op = new VarOperation();

        op.var       = var;
        op.operation = "=";
        if (test)
        {
            op.operation = ">";
        }
        op.value = "0";

        if (op.var.Equals("{NEW}"))
        {
            // Var name doesn localize
            varText = new QuestEditorTextEdit(VAR_NAME, "", delegate { NewVar(op, test); });
            varText.EditText();
        }
        else
        {
            if (test)
            {
                if (component.tests.VarTestsComponents.Count == 0)
                {
                    component.tests.Add(op);
                }
                else
                {
                    component.tests.Add(new VarTestsLogicalOperator());
                    component.tests.Add(op);
                }
            }
            else
            {
                component.operations.Add(op);
            }
            Update();
        }
    }