private void DrawSynchronizedVariables(VariableSynchronizer variableSynchronizer) { GUI.enabled = (true); if (variableSynchronizer.SynchronizedVariables == null || variableSynchronizer.SynchronizedVariables.Count == 0) { return; } Rect lastRect = GUILayoutUtility.GetLastRect(); lastRect.x = (-5f); lastRect.y = (lastRect.y + (lastRect.height + 1f)); lastRect.height = (2f); lastRect.width = (lastRect.width + 20f); GUI.DrawTexture(lastRect, BehaviorDesignerUtility.LoadTexture("ContentSeparator", true)); GUILayout.Space(6f); for (int i = 0; i < variableSynchronizer.SynchronizedVariables.Count; i++) { VariableSynchronizer.SynchronizedVariable synchronizedVariable = variableSynchronizer.SynchronizedVariables[i]; if (synchronizedVariable.global) { if (GlobalVariables.Instance.GetVariable(synchronizedVariable.variableName) == null) { variableSynchronizer.SynchronizedVariables.RemoveAt(i); break; } } else if (synchronizedVariable.behavior.GetVariable(synchronizedVariable.variableName) == null) { variableSynchronizer.SynchronizedVariables.RemoveAt(i); break; } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.LabelField(synchronizedVariable.variableName, new GUILayoutOption[] { GUILayout.MaxWidth(120f) }); if (GUILayout.Button(BehaviorDesignerUtility.LoadTexture((!synchronizedVariable.setVariable) ? "RightArrowButton" : "LeftArrowButton", true), BehaviorDesignerUtility.ButtonGUIStyle, new GUILayoutOption[] { GUILayout.Width(22f) }) && !Application.isPlaying) { synchronizedVariable.setVariable = !synchronizedVariable.setVariable; } EditorGUILayout.LabelField(string.Format("{0} ({1})", synchronizedVariable.targetName, synchronizedVariable.synchronizationType.ToString()), new GUILayoutOption[] { GUILayout.MinWidth(120f) }); GUILayout.FlexibleSpace(); if (GUILayout.Button(BehaviorDesignerUtility.LoadTexture("DeleteButton.png", true), BehaviorDesignerUtility.ButtonGUIStyle, new GUILayoutOption[] { GUILayout.Width(22f) })) { variableSynchronizer.SynchronizedVariables.RemoveAt(i); EditorGUILayout.EndHorizontal(); break; } GUILayout.Space(2f); EditorGUILayout.EndHorizontal(); GUILayout.Space(2f); } GUILayout.Space(4f); }
public void OnEnable() { this.m_WelcomeScreenImage = BehaviorDesignerUtility.LoadTexture("WelcomeScreenHeader.png", false, this); this.m_SamplesImage = BehaviorDesignerUtility.LoadIcon("WelcomeScreenSamplesIcon.png", this); this.m_DocImage = BehaviorDesignerUtility.LoadIcon("WelcomeScreenDocumentationIcon.png", this); this.m_VideoImage = BehaviorDesignerUtility.LoadIcon("WelcomeScreenVideosIcon.png", this); this.m_ForumImage = BehaviorDesignerUtility.LoadIcon("WelcomeScreenForumIcon.png", this); this.m_ContactImage = BehaviorDesignerUtility.LoadIcon("WelcomeScreenContactIcon.png", this); }
private static void ExportTexture(string path, bool skin = false) { var icon = BehaviorDesignerUtility.LoadTexture(path, skin); if (icon != null) { //icon.Resize (16, 16, TextureFormat.ARGB32, false); var data = icon.EncodeToPNG(); File.WriteAllBytes("Assets/DebugSystem/Icons/" + path, data); AssetDatabase.Refresh(); } }
public override void OnInspectorGUI() { VariableSynchronizer variableSynchronizer = this.target as VariableSynchronizer; if (variableSynchronizer == null) { return; } GUILayout.Space(5f); variableSynchronizer.UpdateInterval = (UpdateIntervalType)EditorGUILayout.EnumPopup("Update Interval", variableSynchronizer.UpdateInterval, new GUILayoutOption[0]); if (variableSynchronizer.UpdateInterval == UpdateIntervalType.SpecifySeconds) { variableSynchronizer.UpdateIntervalSeconds = EditorGUILayout.FloatField("Seconds", variableSynchronizer.UpdateIntervalSeconds, new GUILayoutOption[0]); } GUILayout.Space(5f); GUI.enabled = (!Application.isPlaying); this.DrawSharedVariableSynchronizer(this.sharedVariableSynchronizer, null); if (string.IsNullOrEmpty(this.sharedVariableSynchronizer.targetName)) { this.DrawSynchronizedVariables(variableSynchronizer); return; } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.LabelField("Direction", new GUILayoutOption[] { GUILayout.MaxWidth(146f) }); if (GUILayout.Button(BehaviorDesignerUtility.LoadTexture((!this.setVariable) ? "RightArrowButton.png" : "LeftArrowButton.png", true, this), BehaviorDesignerUtility.ButtonGUIStyle, new GUILayoutOption[] { GUILayout.Width(22f) })) { this.setVariable = !this.setVariable; } EditorGUILayout.EndHorizontal(); EditorGUI.BeginChangeCheck(); this.synchronizationType = (VariableSynchronizer.SynchronizationType)EditorGUILayout.EnumPopup("Type", this.synchronizationType, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.targetSynchronizer = new VariableSynchronizerInspector.Synchronizer(); } if (this.targetSynchronizer == null) { this.targetSynchronizer = new VariableSynchronizerInspector.Synchronizer(); } if (this.sharedVariableValueType == null && !string.IsNullOrEmpty(this.sharedVariableValueTypeName)) { this.sharedVariableValueType = TaskUtility.GetTypeWithinAssembly(this.sharedVariableValueTypeName); } switch (this.synchronizationType) { case VariableSynchronizer.SynchronizationType.BehaviorDesigner: this.DrawSharedVariableSynchronizer(this.targetSynchronizer, this.sharedVariableValueType); break; case VariableSynchronizer.SynchronizationType.Property: this.DrawPropertySynchronizer(this.targetSynchronizer, this.sharedVariableValueType); break; case VariableSynchronizer.SynchronizationType.Animator: this.DrawAnimatorSynchronizer(this.targetSynchronizer); break; case VariableSynchronizer.SynchronizationType.PlayMaker: this.DrawPlayMakerSynchronizer(this.targetSynchronizer, this.sharedVariableValueType); break; case VariableSynchronizer.SynchronizationType.uFrame: this.DrawuFrameSynchronizer(this.targetSynchronizer, this.sharedVariableValueType); break; } if (string.IsNullOrEmpty(this.targetSynchronizer.targetName)) { GUI.enabled = (false); } if (GUILayout.Button("Add", new GUILayoutOption[0])) { VariableSynchronizer.SynchronizedVariable item = new VariableSynchronizer.SynchronizedVariable(this.synchronizationType, this.setVariable, this.sharedVariableSynchronizer.component as Behavior, this.sharedVariableSynchronizer.targetName, this.sharedVariableSynchronizer.global, this.targetSynchronizer.component, this.targetSynchronizer.targetName, this.targetSynchronizer.global); variableSynchronizer.SynchronizedVariables.Add(item); EditorUtility.SetDirty(variableSynchronizer); this.sharedVariableSynchronizer = new VariableSynchronizerInspector.Synchronizer(); this.targetSynchronizer = new VariableSynchronizerInspector.Synchronizer(); } GUI.enabled = (true); this.DrawSynchronizedVariables(variableSynchronizer); }