예제 #1
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            numSockets = EditorGUILayout.DelayedIntField("# of possible values:", numSockets);
            numSockets = Mathf.Clamp(numSockets, 1, 100);

            disallowSuccessive = EditorGUILayout.Toggle("Prevent same value twice?", disallowSuccessive);

            if (disallowSuccessive)
            {
                saveToVariable = EditorGUILayout.Toggle("Save last value?", saveToVariable);
                if (saveToVariable)
                {
                    location = (VariableLocation)EditorGUILayout.EnumPopup("Variable source:", location);

                    if (location == VariableLocation.Local && KickStarter.localVariables == null)
                    {
                        EditorGUILayout.HelpBox("No 'Local Variables' component found in the scene. Please add an AC GameEngine object from the Scene Manager.", MessageType.Info);
                    }
                    else if (location == VariableLocation.Local && isAssetFile)
                    {
                        EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info);
                    }

                    if ((location == VariableLocation.Global && AdvGame.GetReferences().variablesManager != null) ||
                        (location == VariableLocation.Local && KickStarter.localVariables != null && !isAssetFile) ||
                        (location == VariableLocation.Component))
                    {
                        ParameterType _parameterType = ParameterType.GlobalVariable;
                        if (location == VariableLocation.Local)
                        {
                            _parameterType = ParameterType.LocalVariable;
                        }
                        else if (location == VariableLocation.Component)
                        {
                            _parameterType = ParameterType.ComponentVariable;
                        }

                        parameterID = Action.ChooseParameterGUI("Integer variable:", parameters, parameterID, _parameterType);
                        if (parameterID >= 0)
                        {
                            if (location == VariableLocation.Component)
                            {
                                variablesConstantID = 0;
                                variables           = null;
                            }

                            variableID = ShowVarGUI(variableID, false);
                        }
                        else
                        {
                            if (location == VariableLocation.Component)
                            {
                                variables           = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true);
                                variablesConstantID = FieldToID <Variables> (variables, variablesConstantID);
                                variables           = IDToField <Variables> (variables, variablesConstantID, false);

                                if (variables != null)
                                {
                                    variableID = ShowVarGUI(variableID, true);
                                }
                            }
                            else
                            {
                                EditorGUILayout.BeginHorizontal();
                                variableID = ShowVarGUI(variableID, true);

                                if (GUILayout.Button(string.Empty, CustomStyles.IconCog))
                                {
                                    SideMenu();
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        public override int GetVariableReferences(List <ActionParameter> parameters, VariableLocation _location, int varID, Variables _variables)
        {
            int thisCount = 0;

            if (saveToVariable && location == _location && variableID == varID && parameterID < 0)
            {
                if (location != VariableLocation.Component || (variables != null && variables == _variables))
                {
                    thisCount++;
                }
            }
            thisCount += base.GetVariableReferences(parameters, _location, varID, _variables);
            return(thisCount);
        }
        public override int GetVariableReferences(List <ActionParameter> parameters, VariableLocation location, int varID, Variables _variables)
        {
            int thisCount = 0;

            string tokenText = AdvGame.GetVariableTokenText(location, varID);

            if (!string.IsNullOrEmpty(tokenText) && !string.IsNullOrEmpty(messageText) && messageText.Contains(tokenText) && messageParameterID < 0)
            {
                thisCount++;
            }
            thisCount += base.GetVariableReferences(parameters, location, varID, _variables);
            return(thisCount);
        }