コード例 #1
0
        private string GetLabelString(List <GVar> vars)
        {
            string labelAdd = "";

            if (vars.Count > 0 && vars.Count > variableNumber && variableNumber > -1)
            {
                labelAdd = " (" + vars[variableNumber].label;

                if (vars [variableNumber].type == VariableType.Boolean)
                {
                    labelAdd += " " + boolCondition.ToString() + " " + boolValue.ToString();
                }
                else if (vars [variableNumber].type == VariableType.Integer)
                {
                    labelAdd += " " + intCondition.ToString() + " " + intValue.ToString();
                }
                else if (vars [variableNumber].type == VariableType.Float)
                {
                    labelAdd += " " + intCondition.ToString() + " " + floatValue.ToString();
                }
                else if (vars [variableNumber].type == VariableType.String)
                {
                    labelAdd += " " + boolCondition.ToString() + " " + stringValue;
                }
                else if (vars [variableNumber].type == VariableType.PopUp)
                {
                    labelAdd += " " + intCondition.ToString() + " " + vars[variableNumber].popUps[intValue];
                }

                labelAdd += ")";
            }

            return(labelAdd);
        }
コード例 #2
0
        private string GetLabelString(List <InvVar> attributes)
        {
            string labelAdd = string.Empty;

            if (attributes.Count > 0 && attributes.Count > attributeNumber && attributeNumber > -1)
            {
                labelAdd = attributes[attributeNumber].label;

                if (attributes [attributeNumber].type == VariableType.Boolean)
                {
                    labelAdd += " " + boolCondition.ToString() + " " + boolValue.ToString();
                }
                else if (attributes [attributeNumber].type == VariableType.Integer)
                {
                    labelAdd += " " + intCondition.ToString() + " " + intValue.ToString();
                }
                else if (attributes [attributeNumber].type == VariableType.Float)
                {
                    labelAdd += " " + intCondition.ToString() + " " + floatValue.ToString();
                }
                else if (attributes [attributeNumber].type == VariableType.String)
                {
                    labelAdd += " " + boolCondition.ToString() + " " + stringValue;
                }
                else if (attributes [attributeNumber].type == VariableType.PopUp)
                {
                    labelAdd += " " + intCondition.ToString() + " " + attributes[attributeNumber].GetPopUpForIndex(intValue);
                }
            }

            return(labelAdd);
        }
コード例 #3
0
 override public string SetLabel()
 {
     if (dragObject != null)
     {
         return(dragObject.gameObject.name + " " + condition.ToString() + " " + checkPosition);
     }
     return("");
 }
コード例 #4
0
        private string GetLabelString(List <GVar> vars)
        {
            string labelAdd = string.Empty;

            if (parameterID < 0 && vars.Count > 0 && vars.Count > variableNumber && variableNumber > -1)
            {
                labelAdd = vars[variableNumber].label;

                switch (vars[variableNumber].type)
                {
                case VariableType.Boolean:
                    labelAdd += " " + boolCondition.ToString() + " " + boolValue.ToString();
                    break;

                case VariableType.Integer:
                    labelAdd += " " + intCondition.ToString() + " " + intValue.ToString();
                    break;

                case VariableType.Float:
                    labelAdd += " " + intCondition.ToString() + " " + floatValue.ToString();
                    break;

                case VariableType.String:
                    labelAdd += " " + boolCondition.ToString() + " " + stringValue;
                    break;

                case VariableType.PopUp:
                    labelAdd += " " + intCondition.ToString() + " " + vars[variableNumber].GetPopUpForIndex(intValue);
                    break;

                default:
                    break;
                }
            }

            return(labelAdd);
        }
コード例 #5
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            if (inventoryManager == null && AdvGame.GetReferences().inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }
            if (settingsManager == null && AdvGame.GetReferences().settingsManager)
            {
                settingsManager = AdvGame.GetReferences().settingsManager;
            }

            invCheckType = (InvCheckType)EditorGUILayout.EnumPopup("Check to make:", invCheckType);
            if (invCheckType == InvCheckType.NumberOfItemsCarrying)
            {
                intCondition = (IntCondition)EditorGUILayout.EnumPopup("Count is:", intCondition);

                intValueParameterID = Action.ChooseParameterGUI(intCondition.ToString() + ":", parameters, intValueParameterID, ParameterType.Integer);
                if (intValueParameterID < 0)
                {
                    intValue = EditorGUILayout.IntField(intCondition.ToString() + ":", intValue);
                }

                SetPlayerGUI();
                return;
            }

            if (inventoryManager)
            {
                // Create a string List of the field's names (for the PopUp box)
                List <string> labelList = new List <string>();

                int i = 0;
                if (parameterID == -1)
                {
                    invNumber = -1;
                }

                if (inventoryManager.items.Count > 0)
                {
                    foreach (InvItem _item in inventoryManager.items)
                    {
                        labelList.Add(_item.label);

                        // If an item has been removed, make sure selected variable is still valid
                        if (_item.id == invID)
                        {
                            invNumber = i;
                        }

                        i++;
                    }

                    if (invNumber == -1)
                    {
                        // Wasn't found (item was possibly deleted), so revert to zero
                        ACDebug.LogWarning("Previously chosen item no longer exists!");

                        invNumber = 0;
                        invID     = 0;
                    }

                    //
                    parameterID = Action.ChooseParameterGUI("Inventory item:", parameters, parameterID, ParameterType.InventoryItem);
                    if (parameterID >= 0)
                    {
                        invNumber = Mathf.Min(invNumber, inventoryManager.items.Count - 1);
                        invID     = -1;
                    }
                    else
                    {
                        invNumber = EditorGUILayout.Popup("Inventory item:", invNumber, labelList.ToArray());
                        invID     = inventoryManager.items[invNumber].id;
                    }
                    //

                    if (inventoryManager.items[invNumber].canCarryMultiple)
                    {
                        doCount = EditorGUILayout.Toggle("Query count?", doCount);

                        if (doCount)
                        {
                            intCondition        = (IntCondition)EditorGUILayout.EnumPopup("Count is:", intCondition);
                            intValueParameterID = Action.ChooseParameterGUI(intCondition.ToString() + ":", parameters, intValueParameterID, ParameterType.Integer);
                            if (intValueParameterID < 0)
                            {
                                intValue = EditorGUILayout.IntField(intCondition.ToString() + ":", intValue);

                                if (intValue < 1)
                                {
                                    intValue = 1;
                                }
                            }
                        }
                    }
                    else
                    {
                        doCount = false;
                    }

                    SetPlayerGUI();
                }
                else
                {
                    EditorGUILayout.LabelField("No inventory items exist!");
                    invID     = -1;
                    invNumber = -1;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("An Inventory Manager must be assigned for this Action to work", MessageType.Warning);
            }
        }