示例#1
0
        protected override void OnBuildGui(ref Rect position, SerializedProperty property, GUIContent label)
        {
            bool drawCreateButton  = GetPropertyTypeName(property) != "IVariableSO" && SO.SO_SystemSettings.Inistance.ShowAssignButton;
            bool drawVariabelValue = SO.SO_SystemSettings.Inistance.ShowVarSOValue;

            variableSORef = (IVariableSO)SORef;
            CalculateLAyout(ref position);

            //  uncomment to debug draw area ------------------------------------------------------
            // DebugDrawArea(position);

            //first field --------------------------------------
            if (variableSORef)//hase value
            {
                if (drawVariabelValue)
                {
                    //value inside variableSO
                    VraiableField(leftRow, label, variableSORef); //input field
                }
                else
                {
                    AddProberty(ref position, property, label);
                }
            }
            else //no value
            {
                if (drawCreateButton)
                {
                    AddProberty(ref leftRow, property, label);
                }
                else
                {
                    AddProberty(ref position, property, label);
                }
            }

            //secound field-------------------------------------------
            EditorGUI.indentLevel       = 0;
            EditorGUIUtility.labelWidth = .1f;
            if (variableSORef)//hase value
            {
                if (drawVariabelValue)
                {
                    //VariableSO refrence
                    AddProberty(ref rightRow, property, new GUIContent(" "));
                }
            }
            else
            {
                if (drawCreateButton)
                {
                    if (GUI.Button(rightRow, "Assign"))
                    {
                        AssignAsync(property, label.text);
                    }
                }
            }
            AssignToPropertyIfTheObjectIsCreated(property, label.text);
        }
示例#2
0
        protected override void VraiableField(Rect position, GUIContent label, IVariableSO variableSO)
        {
            var enumStringVal = variableSO.ToString();
            var originalValue = (T)Enum.Parse(typeof(T), enumStringVal);
            var newValue      = EditorGUI.EnumPopup(position, label, originalValue);;

            variableSO.SetValue(Enum.GetName(typeof(T), newValue));
        }
示例#3
0
 public static bool TryParse(string inistanceID, out IVariableSO variableSO)
 {
     try
     {
         variableSO = IVariableSO.Parse(inistanceID);
         return(true);
     }
     catch (Exception)
     {
         variableSO = null;
         return(false);
     }
 }
示例#4
0
 protected virtual void VraiableField(Rect Position, GUIContent label, IVariableSO variableSO)
 {
     if (variableSO.ToString("ID") == "ID" || variableSO.ToString("ID") == "-ID") //check if formating made issue with data
     {
         float ParsedNum;
         if (float.TryParse(variableSO.ToString(), out ParsedNum))
         {
             variableSO.SetValue(EditorGUI.FloatField(Position, label, ParsedNum).ToString());
         }
         else
         {
             variableSO.SetValue(EditorGUI.TextField(Position, label, variableSO.ToString()));
         }
     }
     else
     {
         variableSO.SetValue(EditorGUI.TextField(Position, label, variableSO.ToString("ID")));
     }
 }
示例#5
0
        protected override void VraiableField(Rect position, GUIContent label, IVariableSO variableSO)
        {
            var varRefrence = (FloatSO)variableSO;

            varRefrence.Value = EditorGUI.FloatField(position, label, varRefrence.Value);
        }
示例#6
0
        protected override void VraiableField(Rect position, GUIContent label, IVariableSO variableSO)
        {
            var varRefrence = (GameObjectSO)variableSO;

            varRefrence.Value = (GameObject)EditorGUI.ObjectField(position, label, varRefrence.Value, typeof(GameObject), true);
        }