Ejemplo n.º 1
0
        public override void DeleteNode()
        {
            base.DeleteNode();
            DataSplitter dataSplitter = (DataSplitter)logicFunction;

            if (dataSplitter.trueOutput != null)
            {
                dataSplitter.trueOutput.RemoveActionInput(dataSplitter);
            }
            if (dataSplitter.falseOutput != null)
            {
                dataSplitter.falseOutput.RemoveActionInput(dataSplitter);
            }
            foreach (LogicFunction actionInput in dataSplitter.actionInputs)
            {
                actionInput.RemoveActionOutput(dataSplitter);
            }
            if (dataSplitter.dataInput != null)
            {
                if (dataSplitter.dataInput is LogicCondition)
                {
                    ((LogicCondition)dataSplitter.dataInput).RemoveDataOutput(dataSplitter);
                }
                else if (dataSplitter.dataInput is DataVariable)
                {
                    ((DataVariable)dataSplitter.dataInput).RemoveDataOutput(dataSplitter);
                }
                else if (dataSplitter.dataInput is LogicDataFunction)
                {
                    ((LogicDataFunction)dataSplitter.dataInput).RemoveDataOutput(dataSplitter);
                }
            }
            LogicMapEditor.logicMap.logicFunc.Remove(dataSplitter);
            DestroyImmediate(dataSplitter.gameObject);
        }
Ejemplo n.º 2
0
        public void SetActionOutputLink()
        {
            DataSplitter dataSplitter = logicFunction as DataSplitter;

            dataSplitter.SetOutputLink(null);
            selectActionLink = true;
            LogicMapEditor.editor.selectFunctionNode = this;
        }
Ejemplo n.º 3
0
 private void ClearCheck()
 {
     startRealize = false;
     foreach (LogicFunction function in logicFunc)
     {
         if (function is DataSplitter)
         {
             DataSplitter dataSplitter = function as DataSplitter;
             dataSplitter.realizeTrue  = false;
             dataSplitter.realizeFalse = false;
             dataSplitter.checkNode    = false;
         }
         if (function is LogicSplitter)
         {
             LogicSplitter logicSplitter = function as LogicSplitter;
             for (int i = 0; i < logicSplitter.realizeOutputs.Count; i++)
             {
                 logicSplitter.realizeOutputs[i] = false;
             }
         }
     }
     foreach (LogicDataFunction function in dataFunc)
     {
         function.checkNode = false;
     }
     foreach (DataVariable function in dataVariables)
     {
         function.checkNode = false;
     }
     foreach (LogicCondition function in conditions)
     {
         function.checkNode = false;
     }
     foreach (LogicEffect function in effects)
     {
         function.checkNode = false;
     }
 }
Ejemplo n.º 4
0
        public override void DrawWindow()
        {
            ChooseTemperFunction function   = logicFunction as ChooseTemperFunction;
            SerializedObject     soFunction = new SerializedObject(function);

            EditorGUILayout.BeginHorizontal();
            GUIStyle noneActionStyle = new GUIStyle();

            noneActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.gray);
            GUIStyle actionStyle = new GUIStyle();

            actionStyle.normal.background = eUtils.MakeTex(10, 10, Color.blue);
            GUIStyle realizeActionStyle = new GUIStyle();

            realizeActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.magenta);
            if (function.actionInputs.Count == 0)
            {
                if (!function.startFunction)
                {
                    GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    if (!LogicMapEditor.logicMap.startRealize)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }
            else
            {
                bool realizeFlag = false;
                foreach (LogicFunction actionInput in function.actionInputs)
                {
                    if (actionInput is DataSplitter)
                    {
                        DataSplitter input = (DataSplitter)actionInput;
                        if (input.trueOutput == function && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == function && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is LogicSplitter)
                    {
                        LogicSplitter input = (LogicSplitter)actionInput;
                        int           index = input.actionOutputs.IndexOf(function);
                        if (input.realizeOutputs[index])
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is WaitFunction)
                    {
                        WaitFunction input = (WaitFunction)actionInput;
                        if (input.actionOutput == function && input.realize)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChallengeFunction)
                    {
                        ChallengeFunction input = (ChallengeFunction)actionInput;
                        if (input.trueOutput == function && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == function && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChooseMethodFunction)
                    {
                        ChooseMethodFunction input = (ChooseMethodFunction)actionInput;
                        if (input.brutalOutput == function && input.realizeBrutal)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.carefulOutput == function && input.realizeCareful)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.diplomatOutput == function && input.realizeDiplomat)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.scienceOutput == function && input.realizeScience)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                    else if (actionInput is ChooseTemperFunction)
                    {
                        ChooseTemperFunction input = (ChooseTemperFunction)actionInput;
                        if (input.rudeOutput == logicFunction && input.realizeRude)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.prudentOutput == logicFunction && input.realizePrudent)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.cruelOutput == logicFunction && input.realizeCruel)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.principledOutput == logicFunction && input.realizePrincipled)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (realizeFlag)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.FlexibleSpace();
            DrawTemperSelector();
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginVertical();
            if (function.rudeOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                if (function.realizeRude)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.Space(15);
            if (function.prudentOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                if (function.realizePrudent)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.Space(15);
            if (function.mercifulOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                if (function.realizeMerciful)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.Space(15);
            if (function.cruelOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                if (function.realizeCruel)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.Space(15);
            if (function.mercantileOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                if (function.realizeMercantile)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.Space(15);
            if (function.principledOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                if (function.realizePrincipled)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
            GUILayout.Box("", new GUILayoutOption[] { GUILayout.Height(1), GUILayout.ExpandWidth(true) });
            EditorGUILayout.PropertyField(soFunction.FindProperty("dialog"), GUIContent.none, new GUILayoutOption[] { GUILayout.Width(120) });
            EditorGUILayout.BeginVertical();
            EditorGUILayout.EndVertical();
            if (function.dialog != null)
            {
                int dif = function.dialogOutputs.Count - function.dialog.GetEnds().Count;
                if (dif > 0)
                {
                    for (int i = 0; i < dif; i++)
                    {
                        LogicFunction output = function.dialogOutputs[function.dialogOutputs.Count - 1];
                        if (output != null)
                        {
                            output.SetActionInputLink(null);
                        }
                        function.dialogOutputs.RemoveAt(function.dialogOutputs.Count - 1);
                        function.realizeDialogOutput.RemoveAt(function.dialogOutputs.Count - 1);
                    }
                }
                else if (dif < 0)
                {
                    for (int i = 0; i < -dif; i++)
                    {
                        function.dialogOutputs.Add(null);
                        function.realizeDialogOutput.Add(false);
                    }
                }
                dif = function.dialogOutputs.Count - function.dialogTemper.Count;
                if (dif > 0)
                {
                    for (int i = 0; i < dif; i++)
                    {
                        function.dialogTemper.Add(Temper.NULL);
                    }
                }
                else if (dif < 0)
                {
                    for (int i = 0; i < -dif; i++)
                    {
                        function.dialogTemper.RemoveAt(function.dialogTemper.Count - 1);
                    }
                }
                dif = function.dialogOutputs.Count - function.dialogFileNotes.Count;
                if (dif > 0)
                {
                    for (int i = 0; i < dif; i++)
                    {
                        function.dialogFileNotes.Add(null);
                    }
                }
                else if (dif < 0)
                {
                    for (int i = 0; i < -dif; i++)
                    {
                        function.dialogFileNotes.RemoveAt(function.dialogFileNotes.Count - 1);
                    }
                }

                for (int i = 0; i < function.dialog.GetEnds().Count; i++)
                {
                    EditorGUILayout.BeginHorizontal(new GUILayoutOption[] { GUILayout.Height(20) });
                    EditorGUILayout.LabelField(function.dialog.GetEnds()[i].chooseText, new GUILayoutOption[] { GUILayout.Width(100) });
                    GUILayout.FlexibleSpace();
                    LogicFunction output = function.dialogOutputs[i];
                    EditorGUILayout.BeginVertical();
                    GUILayout.FlexibleSpace();
                    if (output == null)
                    {
                        GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (function.realizeDialogOutput[i])
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    GUILayout.FlexibleSpace();
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
            }
            else
            {
                for (int i = 0; i < function.dialogOutputs.Count; i++)
                {
                    LogicFunction output = function.dialogOutputs[function.dialogOutputs.Count - 1];
                    if (output != null)
                    {
                        output.SetActionInputLink(null);
                    }
                    function.dialogOutputs.RemoveAt(function.dialogOutputs.Count - 1);
                    function.realizeDialogOutput.RemoveAt(function.dialogOutputs.Count - 1);
                }
            }
            soFunction.ApplyModifiedProperties();
            function.windowRect.height = 160 + 30;
            if (function.dialog != null)
            {
                function.windowRect.height += 20 * function.dialog.GetEnds().Count;
            }
        }
Ejemplo n.º 5
0
        public override void DrawWindow()
        {
            LogicSplitter logicSplitter = logicFunction as LogicSplitter;

            if (logicSplitter.actionOutputs.Count == 0)
            {
                logicSplitter.windowRect.height = 40;
            }
            else
            {
                logicSplitter.windowRect.height = 20 + 20 * logicSplitter.actionOutputs.Count;
            }
            GUIStyle noneActionStyle = new GUIStyle();

            noneActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.gray);
            GUIStyle actionStyle = new GUIStyle();

            actionStyle.normal.background = eUtils.MakeTex(10, 10, Color.blue);
            GUIStyle realizeActionStyle = new GUIStyle();

            realizeActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.magenta);

            GUILayout.BeginHorizontal();

            if (logicFunction.actionInputs.Count == 0)
            {
                if (!logicFunction.startFunction)
                {
                    GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    if (!LogicMapEditor.logicMap.startRealize)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }
            else
            {
                bool realizeFlag = false;
                foreach (LogicFunction actionInput in logicFunction.actionInputs)
                {
                    if (actionInput is DataSplitter)
                    {
                        DataSplitter input = (DataSplitter)actionInput;
                        if (input.trueOutput == logicFunction && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == logicFunction && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is LogicSplitter)
                    {
                        LogicSplitter input = (LogicSplitter)actionInput;
                        int           index = input.actionOutputs.IndexOf(logicFunction);
                        if (input.realizeOutputs[index])
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is WaitFunction)
                    {
                        WaitFunction input = (WaitFunction)actionInput;
                        if (input.actionOutput == logicFunction && input.realize)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChallengeFunction)
                    {
                        ChallengeFunction input = (ChallengeFunction)actionInput;
                        if (input.trueOutput == logicFunction && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == logicFunction && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChooseMethodFunction)
                    {
                        ChooseMethodFunction input = (ChooseMethodFunction)actionInput;
                        if (input.brutalOutput == logicFunction && input.realizeBrutal)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.carefulOutput == logicFunction && input.realizeCareful)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.diplomatOutput == logicFunction && input.realizeDiplomat)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.scienceOutput == logicFunction && input.realizeScience)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                    else if (actionInput is ChooseTemperFunction)
                    {
                        ChooseTemperFunction input = (ChooseTemperFunction)actionInput;
                        if (input.rudeOutput == logicFunction && input.realizeRude)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.prudentOutput == logicFunction && input.realizePrudent)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.cruelOutput == logicFunction && input.realizeCruel)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.principledOutput == logicFunction && input.realizePrincipled)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (realizeFlag)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            for (int i = 0; i < logicSplitter.actionOutputs.Count; i++)
            {
                if (logicSplitter.actionOutputs[i] == null)
                {
                    GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    if (!logicSplitter.realizeOutputs[i])
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
                if (i < logicSplitter.actionOutputs.Count - 1)
                {
                    GUILayout.FlexibleSpace();
                }
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 6
0
        public override void DrawWindow()
        {
            LogicEffect logicEffect = logicFunction as LogicEffect;

            EditorGUILayout.BeginHorizontal();
            GUIStyle noneActionStyle = new GUIStyle();

            noneActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.gray);
            GUIStyle actionStyle = new GUIStyle();

            actionStyle.normal.background = eUtils.MakeTex(10, 10, Color.blue);
            GUIStyle realizeActionStyle = new GUIStyle();

            realizeActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.magenta);
            if (logicEffect.actionInputs.Count == 0)
            {
                if (!logicEffect.startFunction)
                {
                    GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    if (!LogicMapEditor.logicMap.startRealize)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }
            else
            {
                bool realizeFlag = false;
                foreach (LogicFunction actionInput in logicEffect.actionInputs)
                {
                    if (actionInput is DataSplitter)
                    {
                        DataSplitter input = (DataSplitter)actionInput;
                        if (input.trueOutput == logicEffect && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == logicEffect && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is LogicSplitter)
                    {
                        LogicSplitter input = (LogicSplitter)actionInput;
                        int           index = input.actionOutputs.IndexOf(logicEffect);
                        if (input.realizeOutputs[index])
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is WaitFunction)
                    {
                        WaitFunction input = (WaitFunction)actionInput;
                        if (input.actionOutput == logicEffect && input.realize)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChallengeFunction)
                    {
                        ChallengeFunction input = (ChallengeFunction)actionInput;
                        if (input.trueOutput == logicEffect && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == logicEffect && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChooseMethodFunction)
                    {
                        ChooseMethodFunction input = (ChooseMethodFunction)actionInput;
                        if (input.brutalOutput == logicEffect && input.realizeBrutal)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.carefulOutput == logicEffect && input.realizeCareful)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.diplomatOutput == logicEffect && input.realizeDiplomat)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.scienceOutput == logicEffect && input.realizeScience)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                    else if (actionInput is ChooseTemperFunction)
                    {
                        ChooseTemperFunction input = (ChooseTemperFunction)actionInput;
                        if (input.rudeOutput == logicFunction && input.realizeRude)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.prudentOutput == logicFunction && input.realizePrudent)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.cruelOutput == logicFunction && input.realizeCruel)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.principledOutput == logicFunction && input.realizePrincipled)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (realizeFlag)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.FlexibleSpace();
            if (logicEffect.type == LogicEffectType.SINGLE)
            {
                logicEffect.windowRect.height = 140;
                Effect           effect   = logicEffect.effect;
                SerializedObject soEffect = new SerializedObject(effect);
                eUtils.DrawEffectSelector(effect);
            }
            else if (logicEffect.type == LogicEffectType.ARRAY)
            {
                if (logicEffect.effects.Count > 0)
                {
                    logicEffect.windowRect.height = 42 + 20 * logicEffect.effects.Count;
                }
                else
                {
                    logicEffect.windowRect.height = 60;
                }
                EditorGUILayout.BeginVertical();
                for (int i = 0; i < logicEffect.effects.Count; i++)
                {
                    EditorGUILayout.LabelField(logicEffect.effects[i].type.ToString(), new GUILayoutOption[] { GUILayout.Width(140) });
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Dublicate"))
            {
                EffectNode newNode = LogicMapEditor.editor.CreateEffectNode(logicEffect.windowRect.position + new Vector2(20, 20));
                ((LogicEffect)newNode.logicFunction).effect.copyContentFrom(logicEffect.effect);
            }
        }
Ejemplo n.º 7
0
        public override void DrawLinks()
        {
            DataSplitter dataSplitter = logicFunction as DataSplitter;
            Vector2      startPos;
            Vector2      endPos;

            if (dataSplitter.trueOutput != null)
            {
                startPos = new Vector2(dataSplitter.GetWindowRect().xMax, dataSplitter.GetWindowRect().y + 30);
                BaseLogicNode outputNode = null;
                foreach (BaseLogicNode node in LogicMapEditor.editor.nodes)
                {
                    if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == dataSplitter.trueOutput)
                    {
                        outputNode = node;
                    }
                }
                endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25);

                Vector2 startTan    = startPos + Vector2.right * 50;
                Vector2 endTan      = endPos + Vector2.left * 50;
                Color   activeColor = Color.blue;
                Color   backColor   = Color.black;
                if (dataSplitter.realizeTrue)
                {
                    activeColor = Color.magenta;
                }
                backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f);
                int width = 2;

                Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width);
            }
            if (dataSplitter.falseOutput != null)
            {
                startPos = new Vector2(dataSplitter.GetWindowRect().xMax, dataSplitter.GetWindowRect().y + 45);
                BaseLogicNode outputNode = null;
                foreach (BaseLogicNode node in LogicMapEditor.editor.nodes)
                {
                    if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == dataSplitter.falseOutput)
                    {
                        outputNode = node;
                    }
                }
                endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25);

                Vector2 startTan    = startPos + Vector2.right * 50;
                Vector2 endTan      = endPos + Vector2.left * 50;
                Color   activeColor = Color.blue;
                Color   backColor   = Color.black;
                if (dataSplitter.realizeFalse)
                {
                    activeColor = Color.magenta;
                }
                backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f);
                int width = 2;

                Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width);
            }
            if (selectActionLink && dataSplitter.trueFlag)
            {
                Event e = Event.current;
                startPos = new Vector2(dataSplitter.GetWindowRect().xMax, dataSplitter.GetWindowRect().y + 30);
                endPos   = e.mousePosition;
                Vector2 startTan    = startPos + Vector2.right * 50;
                Vector2 endTan      = endPos + Vector2.left * 50;
                Color   activeColor = Color.yellow;
                Color   backColor   = Color.black;
                backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f);
                int width = 2;

                Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width);
            }
            else if (selectActionLink && !dataSplitter.trueFlag)
            {
                Event e = Event.current;
                startPos = new Vector2(dataSplitter.GetWindowRect().xMax, dataSplitter.GetWindowRect().y + 45);
                endPos   = e.mousePosition;
                Vector2 startTan    = startPos + Vector2.right * 50;
                Vector2 endTan      = endPos + Vector2.left * 50;
                Color   activeColor = Color.yellow;
                Color   backColor   = Color.black;
                backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f);
                int width = 2;

                Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width);
            }
        }
Ejemplo n.º 8
0
        public override void DrawWindow()
        {
            DataSplitter dataSplitter = logicFunction as DataSplitter;
            Rect         rect         = dataSplitter.GetWindowRect();

            dataSplitter.SetWindowRect(new Rect(rect.x, rect.y, rect.width, 60));

            GUIStyle noneActionStyle = new GUIStyle();

            noneActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.gray);
            GUIStyle actionStyle = new GUIStyle();

            actionStyle.normal.background = eUtils.MakeTex(10, 10, Color.blue);
            GUIStyle realizeActionStyle = new GUIStyle();

            realizeActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.magenta);
            GUIStyle checkActionStyle = new GUIStyle();

            checkActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.magenta);
            GUIStyle noneDataStyle = new GUIStyle();

            noneDataStyle.normal.background = eUtils.MakeTex(10, 10, Color.black);
            GUIStyle dataStyle = new GUIStyle();

            dataStyle.normal.background = eUtils.MakeTex(10, 10, Color.white);
            GUIStyle trueDataStyle = new GUIStyle();

            trueDataStyle.normal.background = eUtils.MakeTex(10, 10, Color.green);
            GUIStyle falseDataStyle = new GUIStyle();

            falseDataStyle.normal.background = eUtils.MakeTex(10, 10, Color.red);

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            if (dataSplitter.actionInputs.Count == 0)
            {
                if (!dataSplitter.startFunction)
                {
                    GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    if (!LogicMapEditor.logicMap.startRealize)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }
            else
            {
                bool realizeFlag = false;
                foreach (LogicFunction actionInput in dataSplitter.actionInputs)
                {
                    if (actionInput is DataSplitter)
                    {
                        DataSplitter input = (DataSplitter)actionInput;
                        if (input.trueOutput == dataSplitter && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == dataSplitter && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is LogicSplitter)
                    {
                        LogicSplitter input = (LogicSplitter)actionInput;
                        int           index = input.actionOutputs.IndexOf(dataSplitter);
                        if (input.realizeOutputs[index])
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is WaitFunction)
                    {
                        WaitFunction input = (WaitFunction)actionInput;
                        if (input.actionOutput == dataSplitter && input.realize)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChallengeFunction)
                    {
                        ChallengeFunction input = (ChallengeFunction)actionInput;
                        if (input.trueOutput == dataSplitter && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == dataSplitter && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChooseMethodFunction)
                    {
                        ChooseMethodFunction input = (ChooseMethodFunction)actionInput;
                        if (input.brutalOutput == dataSplitter && input.realizeBrutal)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.carefulOutput == dataSplitter && input.realizeCareful)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.diplomatOutput == dataSplitter && input.realizeDiplomat)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.scienceOutput == dataSplitter && input.realizeScience)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                    else if (actionInput is ChooseTemperFunction)
                    {
                        ChooseTemperFunction input = (ChooseTemperFunction)actionInput;
                        if (input.rudeOutput == logicFunction && input.realizeRude)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.prudentOutput == logicFunction && input.realizePrudent)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.cruelOutput == logicFunction && input.realizeCruel)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.principledOutput == logicFunction && input.realizePrincipled)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (realizeFlag)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.FlexibleSpace();

            if (dataSplitter.dataInput == null)
            {
                GUILayout.Box(GUIContent.none, noneDataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                if (dataSplitter.dataInput is LogicCondition)
                {
                    LogicCondition dataInput = dataSplitter.dataInput as LogicCondition;
                    if (!dataInput.GetChackDataNode())
                    {
                        GUILayout.Box(GUIContent.none, dataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (dataInput.GetChackDataNode() && dataInput.GetResult())
                    {
                        GUILayout.Box(GUIContent.none, trueDataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (dataInput.GetChackDataNode() && !dataInput.GetResult())
                    {
                        GUILayout.Box(GUIContent.none, falseDataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
                else if (dataSplitter.dataInput is DataVariable)
                {
                    DataVariable dataInput = dataSplitter.dataInput as DataVariable;
                    if (!dataInput.GetChackDataNode())
                    {
                        GUILayout.Box(GUIContent.none, dataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (dataInput.GetChackDataNode() && dataInput.GetResult())
                    {
                        GUILayout.Box(GUIContent.none, trueDataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (dataInput.GetChackDataNode() && !dataInput.GetResult())
                    {
                        GUILayout.Box(GUIContent.none, falseDataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
                else if (dataSplitter.dataInput is LogicDataFunction)
                {
                    LogicDataFunction dataInput = dataSplitter.dataInput as LogicDataFunction;
                    if (!dataInput.GetChackDataNode())
                    {
                        GUILayout.Box(GUIContent.none, dataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (dataInput.GetChackDataNode() && dataInput.GetResult())
                    {
                        GUILayout.Box(GUIContent.none, trueDataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (dataInput.GetChackDataNode() && !dataInput.GetResult())
                    {
                        GUILayout.Box(GUIContent.none, falseDataStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("T");
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            if (dataSplitter.trueOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else if (!dataSplitter.realizeTrue)
            {
                GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.Label("F");
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            if (dataSplitter.falseOutput == null)
            {
                GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else if (!dataSplitter.realizeFalse)
            {
                GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            else
            {
                GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 9
0
 private void RealizeFunction(LogicFunction function, bool isTest = false)
 {
     if (function is LogicSplitter)
     {
         List <LogicFunction> outputs = ((LogicSplitter)function).actionOutputs;
         for (int i = 0; i < outputs.Count; i++)
         {
             ((LogicSplitter)function).realizeOutputs[i] = true;
             RealizeFunction(outputs[i], isTest);
         }
     }
     else if (function is DataSplitter)
     {
         DataSplitter dataSplitter = (DataSplitter)function;
         bool         result       = dataSplitter.GetResult();
         if (result)
         {
             dataSplitter.realizeTrue = true;
             RealizeFunction(dataSplitter.trueOutput, isTest);
         }
         else
         {
             dataSplitter.realizeFalse = true;
             RealizeFunction(dataSplitter.falseOutput, isTest);
         }
     }
     else if (function is LogicEffect)
     {
         ((LogicEffect)function).Realize(curOwner, team, isTest);
     }
     else if (function is WaitFunction)
     {
         ((WaitFunction)function).CreateWaitAction(delegate { RealizeFunction(((WaitFunction)function).actionOutput, isTest); });
     }
     else if (function is ChallengeFunction)
     {
         ChallengeFunction challengeFunction = (ChallengeFunction)function;
         challengeFunction.CreateWaitAction(curOwner, delegate
         {
             challengeFunction.realizeTrue  = true;
             challengeFunction.realizeFalse = false;
             if (challengeFunction.trueFileNote != null)
             {
                 curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                 curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(challengeFunction.trueFileNote, curOwner.GetTeam().transform));
             }
             RealizeFunction(challengeFunction.trueOutput, isTest);
         }, delegate {
             challengeFunction.realizeTrue  = false;
             challengeFunction.realizeFalse = true;
             if (challengeFunction.falseFileNote != null)
             {
                 curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                 curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(challengeFunction.falseFileNote, curOwner.GetTeam().transform));
             }
             RealizeFunction(challengeFunction.falseOutput, isTest);
         });
     }
     else if (function is ChooseMethodFunction)
     {
         ChooseMethodFunction methodFunction = (ChooseMethodFunction)function;
         if (methodFunction.dialog == null || !curOwner.GetTeam().GetLeader().IsObedient())
         {
             Method method = methodFunction.Realize(curOwner);
             Debug.Log(string.Format("ChooseMethod - {0}", method.ToString()), methodFunction);
             if (method == Method.Brutal)
             {
                 if (methodFunction.brutalFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(methodFunction.brutalFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(methodFunction.brutalOutput, isTest);
             }
             else if (method == Method.Accuracy)
             {
                 if (methodFunction.carefulFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(methodFunction.carefulFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(methodFunction.carefulOutput, isTest);
             }
             else if (method == Method.Diplomacy)
             {
                 if (methodFunction.diplomatFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(methodFunction.diplomatFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(methodFunction.diplomatOutput, isTest);
             }
             else if (method == Method.Science)
             {
                 if (methodFunction.scienceFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(methodFunction.scienceFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(methodFunction.scienceOutput, isTest);
             }
         }
         else
         {
             Debug.Log(string.Format("ChooseMethod start dialog"), methodFunction);
             UnityAction action = delegate
             {
                 int index = methodFunction.dialog.GetEnds().IndexOf(methodFunction.dialog.end);
                 if (methodFunction.dialogFileNotes[index] != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(methodFunction.dialogFileNotes[index], curOwner.GetTeam().transform));
                 }
                 RealizeFunction(methodFunction.dialogOutputs[index], isTest);
             };
             Dialog.DialogManager.GetInstantiate().StartDialog(methodFunction.dialog, curOwner.GetTeam(), ((iEffectsContainer)curOwner).GetQuest(), action);
         }
     }
     else if (function is ChooseTemperFunction)
     {
         ChooseTemperFunction temperFunction = (ChooseTemperFunction)function;
         if (temperFunction.dialog == null || !curOwner.GetTeam().GetLeader().IsObedient())
         {
             Temper temper = temperFunction.Realize(curOwner);
             Debug.Log(string.Format("ChooseTemper - {0}", temper.ToString()), temperFunction);
             if (temper == Temper.RUDE)
             {
                 if (temperFunction.rudeFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(temperFunction.rudeFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(temperFunction.rudeOutput, isTest);
             }
             else if (temper == Temper.PRUDENT)
             {
                 if (temperFunction.prudentFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(temperFunction.prudentFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(temperFunction.prudentOutput, isTest);
             }
             else if (temper == Temper.MERCIFUL)
             {
                 if (temperFunction.mercifulFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(temperFunction.mercifulFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(temperFunction.mercifulOutput, isTest);
             }
             else if (temper == Temper.CRUEL)
             {
                 if (temperFunction.cruelFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(temperFunction.cruelFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(temperFunction.cruelOutput, isTest);
             }
             else if (temper == Temper.MERCANTILE)
             {
                 if (temperFunction.mercantileFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(temperFunction.mercantileFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(temperFunction.mercantileOutput, isTest);
             }
             else if (temper == Temper.PRINCIPLED)
             {
                 if (temperFunction.principledFileNote != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(temperFunction.principledFileNote, curOwner.GetTeam().transform));
                 }
                 RealizeFunction(temperFunction.principledOutput, isTest);
             }
         }
         else
         {
             Debug.Log(string.Format("ChooseTemper start dialog"), temperFunction);
             UnityAction action = delegate
             {
                 int index = temperFunction.dialog.GetEnds().IndexOf(temperFunction.dialog.end);
                 temperFunction.LoyaltyInfluence(temperFunction.dialogTemper[index], curOwner);
                 if (temperFunction.dialogFileNotes[index] != null)
                 {
                     curOwner.GetTeam().reportQuest.Add(((iEffectsContainer)curOwner).GetQuest());
                     curOwner.GetTeam().reportNotes.Add(FileNoteContainer.Create(temperFunction.dialogFileNotes[index], curOwner.GetTeam().transform));
                 }
                 RealizeFunction(temperFunction.dialogOutputs[index], isTest);
             };
             Dialog.DialogManager.GetInstantiate().StartDialog(temperFunction.dialog, curOwner.GetTeam(), ((iEffectsContainer)curOwner).GetQuest(), action);
         }
     }
 }
Ejemplo n.º 10
0
        public override void DrawWindow()
        {
            WaitFunction     waitFunction = logicFunction as WaitFunction;
            SerializedObject soWait       = new SerializedObject(waitFunction);

            EditorGUILayout.BeginHorizontal();
            GUIStyle noneActionStyle = new GUIStyle();

            noneActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.gray);
            GUIStyle actionStyle = new GUIStyle();

            actionStyle.normal.background = eUtils.MakeTex(10, 10, Color.blue);
            GUIStyle realizeActionStyle = new GUIStyle();

            realizeActionStyle.normal.background = eUtils.MakeTex(10, 10, Color.magenta);
            if (logicFunction.actionInputs.Count == 0)
            {
                if (!logicFunction.startFunction)
                {
                    GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    if (!LogicMapEditor.logicMap.startRealize)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }
            else
            {
                bool realizeFlag = false;
                foreach (LogicFunction actionInput in logicFunction.actionInputs)
                {
                    if (actionInput is DataSplitter)
                    {
                        DataSplitter input = (DataSplitter)actionInput;
                        if (input.trueOutput == logicFunction && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == logicFunction && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is LogicSplitter)
                    {
                        LogicSplitter input = (LogicSplitter)actionInput;
                        int           index = input.actionOutputs.IndexOf(logicFunction);
                        if (input.realizeOutputs[index])
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is WaitFunction)
                    {
                        WaitFunction input = (WaitFunction)actionInput;
                        if (input.actionOutput == logicFunction && input.realize)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChallengeFunction)
                    {
                        ChallengeFunction input = (ChallengeFunction)actionInput;
                        if (input.trueOutput == logicFunction && input.realizeTrue)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.falseOutput == logicFunction && input.realizeFalse)
                        {
                            realizeFlag = true;
                            break;
                        }
                    }
                    else if (actionInput is ChooseMethodFunction)
                    {
                        ChooseMethodFunction input = (ChooseMethodFunction)actionInput;
                        if (input.brutalOutput == logicFunction && input.realizeBrutal)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.carefulOutput == logicFunction && input.realizeCareful)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.diplomatOutput == logicFunction && input.realizeDiplomat)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.scienceOutput == logicFunction && input.realizeScience)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                    else if (actionInput is ChooseTemperFunction)
                    {
                        ChooseTemperFunction input = (ChooseTemperFunction)actionInput;
                        if (input.rudeOutput == logicFunction && input.realizeRude)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.prudentOutput == logicFunction && input.realizePrudent)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.cruelOutput == logicFunction && input.realizeCruel)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else if (input.principledOutput == logicFunction && input.realizePrincipled)
                        {
                            realizeFlag = true;
                            break;
                        }
                        else
                        {
                            for (int i = 0; i < input.dialogOutputs.Count; i++)
                            {
                                if (input.dialogOutputs[i] == logicFunction && input.realizeDialogOutput[i])
                                {
                                    realizeFlag = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (realizeFlag)
                {
                    GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField(waitFunction.waitType.ToString(), new GUILayoutOption[] { GUILayout.Width(100) });
            if (waitFunction.waitType == WaitType.ABSOLUTE || waitFunction.waitType == WaitType.RELATION)
            {
                EditorGUILayout.LabelField(string.Format("{0}m, {1}w, {2}d", waitFunction.waitTime.months, waitFunction.waitTime.weeks, waitFunction.waitTime.days), new GUILayoutOption[] { GUILayout.Width(100) });
                EditorGUILayout.LabelField(string.Format("{0}:{1}", waitFunction.waitTime.hours, waitFunction.waitTime.minutes.ToString("00")), new GUILayoutOption[] { GUILayout.Width(100) });
            }
            else if (waitFunction.waitType == WaitType.ABSOLUTE_HOURS)
            {
                EditorGUILayout.LabelField(string.Format("{0}:{1}", waitFunction.waitTime.hours, waitFunction.waitTime.minutes.ToString("00")), new GUILayoutOption[] { GUILayout.Width(100) });
            }
            EditorGUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            if (waitFunction.actionOutput == null)
            {
                if (!waitFunction.startFunction)
                {
                    GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                }
                else
                {
                    if (!LogicMapEditor.logicMap.startRealize)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }
            else
            {
                if (waitFunction.actionOutput is DataSplitter)
                {
                    DataSplitter output = (DataSplitter)waitFunction.actionOutput;
                    if (output.trueOutput == waitFunction && !output.realizeTrue)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (output.trueOutput == waitFunction && output.realizeTrue)
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (output.falseOutput == waitFunction && !output.realizeFalse)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else if (output.falseOutput == waitFunction && output.realizeFalse)
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
                else if (waitFunction.actionOutput is LogicSplitter)
                {
                    LogicSplitter output = (LogicSplitter)waitFunction.actionOutput;
                    int           index  = output.actionOutputs.IndexOf(waitFunction);
                    if (index == -1)
                    {
                        GUILayout.Box(GUIContent.none, noneActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        if (!waitFunction.realize)
                        {
                            GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                        }
                        else
                        {
                            GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                        }
                    }
                }
                else if (waitFunction.actionOutput is LogicEffect)
                {
                    LogicEffect output = (LogicEffect)waitFunction.actionOutput;
                    if (!waitFunction.realize)
                    {
                        GUILayout.Box(GUIContent.none, actionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                    else
                    {
                        GUILayout.Box(GUIContent.none, realizeActionStyle, new GUILayoutOption[] { GUILayout.Width(10), GUILayout.Height(10) });
                    }
                }
            }
            EditorGUILayout.EndHorizontal();
            soWait.ApplyModifiedProperties();
        }