Ejemplo n.º 1
0
        protected override void Draw(Rect rect, DataProvider target, bool isSetter)
        {
            TriggerEventDataProvider triggerEventDataProvider = target as TriggerEventDataProvider;

            EditorGUIUtility.labelWidth = 110f;
            rect.height = EditorGUIUtility.singleLineHeight;
            Rect  rect2 = rect;
            float num   = 0f;

            rect2.width = EditorGUIUtility.labelWidth;
            GUI.Label(rect2, TriggerEventProviderEd.GC_VarHead);
            rect2.x    += EditorGUIUtility.labelWidth;
            rect2.width = (num = (float)((rect.width - (rect2.width + 6.0)) / 2.0));
            triggerEventDataProvider.varName = EditorGUI.TextField(rect2, triggerEventDataProvider.varName);
            Blox blox = null;

            if (!string.IsNullOrEmpty(triggerEventDataProvider.bloxIdent))
            {
                blox = BloxEd.GetBloxDef(triggerEventDataProvider.bloxIdent);
                if ((UnityEngine.Object)blox == (UnityEngine.Object)null)
                {
                    triggerEventDataProvider.bloxIdent = "";
                }
                else
                {
                    TriggerEventProviderEd.GC_BloxName.text = blox.screenName;
                }
            }
            TriggerEventProviderEd.GC_BloxName.text = (((UnityEngine.Object)blox == (UnityEngine.Object)null) ? "-select-" : blox.screenName);
            rect2.x += (float)(rect2.width + 3.0);
            if (GUI.Button(rect2, TriggerEventProviderEd.GC_BloxName))
            {
                BloxListPopup.Show_BloxListPopup(null, this.OnBloxSelected, new object[1]
                {
                    triggerEventDataProvider
                });
            }
            rect2.y    += (float)(EditorGUIUtility.singleLineHeight + 2.0);
            rect2.x     = rect.x;
            rect2.width = EditorGUIUtility.labelWidth;
            GUI.Label(rect2, TriggerEventProviderEd.GC_ObjHead);
            rect2.x    += EditorGUIUtility.labelWidth;
            rect2.width = num;
            triggerEventDataProvider.sourceObjType = (TriggerEventDataProvider.DataSourceOject)EditorGUI.EnumPopup(rect2, (Enum)(object)triggerEventDataProvider.sourceObjType);
            if (triggerEventDataProvider.sourceObjType != TriggerEventDataProvider.DataSourceOject.Owner)
            {
                rect2.x += (float)(rect2.width + 3.0);
                triggerEventDataProvider.objNameOrTag = plyEdGUI.InlineLabelTextField(rect2, (triggerEventDataProvider.sourceObjType == TriggerEventDataProvider.DataSourceOject.WithName) ? TriggerEventProviderEd.GC_ObjName : TriggerEventProviderEd.GC_TagName, triggerEventDataProvider.objNameOrTag);
            }
            rect2.y    += (float)(EditorGUIUtility.singleLineHeight + 2.0);
            rect2.x     = rect.x;
            rect2.width = EditorGUIUtility.labelWidth;
            GUI.Label(rect2, TriggerEventProviderEd.GC_EventHead);
            rect2.x    += EditorGUIUtility.labelWidth;
            rect2.width = rect.width - EditorGUIUtility.labelWidth;
            triggerEventDataProvider.triggerBloxEvent = EditorGUI.TextField(rect2, triggerEventDataProvider.triggerBloxEvent);
            rect2.x     = rect.x;
            rect2.width = rect.width;
            for (int i = 0; i < triggerEventDataProvider.valSetterSources.Length; i++)
            {
                rect2.y += (float)(EditorGUIUtility.singleLineHeight + 2.0);
                TriggerEventProviderEd.GC_Param.text         = string.Format("with param{0} = ", i);
                triggerEventDataProvider.valSetterSources[i] = DataProviderEd.DataBindingValueSourceField(rect2, TriggerEventProviderEd.GC_Param, triggerEventDataProvider.valSetterSources[i], TriggerEventProviderEd.GC_ToValBindWin, triggerEventDataProvider);
            }
            rect2.y    += (float)(EditorGUIUtility.singleLineHeight + 2.0);
            rect2.x     = (float)(rect.xMax - 103.0);
            rect2.width = 50f;
            GUI.Label(rect2, TriggerEventProviderEd.GC_ParamsHead);
            rect2.x    += 53f;
            rect2.width = 25f;
            if (GUI.Button(rect2, Ico._add, plyEdGUI.Styles.MiniButtonLeft))
            {
                DataBindingValueSource item = new DataBindingValueSource();
                ArrayUtility.Add <DataBindingValueSource>(ref triggerEventDataProvider.valSetterSources, item);
                plyEdUtil.SetDirty(triggerEventDataProvider);
            }
            rect2.x    += 25f;
            GUI.enabled = (triggerEventDataProvider.valSetterSources.Length != 0);
            if (GUI.Button(rect2, Ico._remove, plyEdGUI.Styles.MiniButtonRight))
            {
                DataBinding databind = triggerEventDataProvider.valSetterSources[triggerEventDataProvider.valSetterSources.Length - 1].databind;
                DataProviderEd.DestroyDataprovider((databind != null) ? databind.dataprovider : null);
                ArrayUtility.RemoveAt <DataBindingValueSource>(ref triggerEventDataProvider.valSetterSources, triggerEventDataProvider.valSetterSources.Length - 1);
                plyEdUtil.SetDirty(triggerEventDataProvider);
            }
            GUI.enabled = true;
        }
Ejemplo n.º 2
0
        protected override void Draw(Rect rect, DataProvider target, bool isSetter)
        {
            plyVarDataProvider plyVarDataProvider = target as plyVarDataProvider;

            EditorGUIUtility.labelWidth = 30f;
            rect.height = EditorGUIUtility.singleLineHeight;
            Rect  rect2 = rect;
            float num   = (float)((rect.width - (EditorGUIUtility.labelWidth + 3.0)) / 3.0);

            rect2.width = EditorGUIUtility.labelWidth;
            GUI.Label(rect2, isSetter ? plyVarDataProviderEd.GC_SetVar : plyVarDataProviderEd.GC_GetVar);
            rect2.x    += EditorGUIUtility.labelWidth;
            rect2.width = num;
            plyVarDataProvider.varType = (plyVarDataProvider.VariableType)EditorGUI.EnumPopup(rect2, (Enum)(object)plyVarDataProvider.varType);
            rect2.x    += (float)(num + 3.0);
            rect2.width = (float)(rect.width - (num + EditorGUIUtility.labelWidth + 3.0));
            plyVarDataProvider.varName = plyEdGUI.InlineLabelTextField(rect2, plyVarDataProviderEd.GC_VarName, plyVarDataProvider.varName);
            rect2.x += EditorGUIUtility.labelWidth;
            if (plyVarDataProvider.varType != 0)
            {
                rect2.y    += (float)(EditorGUIUtility.singleLineHeight + 2.0);
                rect2.x     = rect.x;
                rect2.width = EditorGUIUtility.labelWidth;
                GUI.Label(rect2, plyVarDataProviderEd.GC_Of);
                rect2.x    += EditorGUIUtility.labelWidth;
                rect2.width = num;
                plyVarDataProvider.sourceObjType = (plyVarDataProvider.DataSourceOject)EditorGUI.EnumPopup(rect2, (Enum)(object)plyVarDataProvider.sourceObjType);
                rect2.x    += (float)(num + 3.0);
                rect2.width = (float)(rect.width - (num + EditorGUIUtility.labelWidth + 3.0));
                if (plyVarDataProvider.varType == plyVarDataProvider.VariableType.Blox)
                {
                    rect2.width = (float)((rect2.width - 5.0) / 2.0);
                }
                if (plyVarDataProvider.sourceObjType != plyVarDataProvider.DataSourceOject.OfOwner)
                {
                    plyVarDataProvider.objNameOrTag = plyEdGUI.InlineLabelTextField(rect2, (plyVarDataProvider.sourceObjType == plyVarDataProvider.DataSourceOject.ObjWithName) ? plyVarDataProviderEd.GC_ObjName : plyVarDataProviderEd.GC_TagName, plyVarDataProvider.objNameOrTag);
                }
                if (plyVarDataProvider.varType == plyVarDataProvider.VariableType.Blox)
                {
                    Blox blox = null;
                    if (!string.IsNullOrEmpty(plyVarDataProvider.bloxIdent))
                    {
                        blox = BloxEd.GetBloxDef(plyVarDataProvider.bloxIdent);
                        if ((UnityEngine.Object)blox == (UnityEngine.Object)null)
                        {
                            plyVarDataProvider.bloxIdent = "";
                        }
                        else
                        {
                            plyVarDataProviderEd.GC_BloxName.text = blox.screenName;
                        }
                    }
                    plyVarDataProviderEd.GC_BloxName.text = (((UnityEngine.Object)blox == (UnityEngine.Object)null) ? "-select-" : blox.screenName);
                    rect2.x += (float)(rect2.width + 3.0);
                    if (GUI.Button(rect2, plyVarDataProviderEd.GC_BloxName))
                    {
                        BloxListPopup.Show_BloxListPopup(null, this.OnBloxSelected, new object[1]
                        {
                            plyVarDataProvider
                        });
                    }
                }
            }
            if (isSetter)
            {
                rect2.y    += (float)(EditorGUIUtility.singleLineHeight + 2.0);
                rect2.x     = rect.x;
                rect2.width = rect.width;
                plyVarDataProvider.valSetterSource = DataProviderEd.DataBindingValueSourceField(rect2, plyVarDataProviderEd.GC_ToVal, plyVarDataProvider.valSetterSource, plyVarDataProviderEd.GC_ToValBindWin, plyVarDataProvider);
            }
        }