Esempio n. 1
0
		public ConditionalPhase(VariableEditorScopes scope, VariableEditorTypes type, int variableId, VariableEditorGetEquation equation, string getValue, List<int> outs) : base(outs){
			this.scope = scope;
			this.type = type;
			this.variableId = variableId;
			this.equation = equation;
			this.getValue = getValue;
		}
		public SetVariablePhase(VariableEditorScopes scope, VariableEditorTypes type, int variableId, VariableEditorSetEquation equation, string setValue, List<int?> outs) : base(outs){
			this.scope = scope;
			this.type = type;
			this.variableId = variableId;
			this.equation = equation;
			this.setValue = setValue;
		}
 public ConditionalPhase(VariableEditorScopes scope, VariableEditorTypes type, int variableId, VariableEditorGetEquation equation, string getValue, List <int?> outs) : base(outs)
 {
     this.scope      = scope;
     this.type       = type;
     this.variableId = variableId;
     this.equation   = equation;
     this.getValue   = getValue;
 }
Esempio n. 4
0
 public SetVariablePhase(VariableEditorScopes scope, VariableEditorTypes type, int variableId, VariableEditorSetEquation equation, string setValue, List <int> outs) : base(outs)
 {
     this.scope      = scope;
     this.type       = type;
     this.variableId = variableId;
     this.equation   = equation;
     this.setValue   = setValue;
 }
 private void setTarget(VariableEditorScopes scope, VariableEditorTypes type)
 {
     if (__scope == scope && __type == type)
     {
         return;
     }
     getVariables().selection = 0;
     __scope = scope;
     __type  = type;
 }
        // NO-VARIABLES WARNING
        public static void drawNoVariablesWarning(Rect container, VariableEditorScopes scope, VariableEditorTypes type)
        {
            if (EditorGUIUtility.isProSkin)
            {
                DialogueEditorGUI.drawShadowedRect(container, 2);
            }
            else
            {
                GUI.Box(container, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
                GUI.Box(container, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
            }
            GUIStyle centered = new GUIStyle("label");

            centered.alignment = TextAnchor.MiddleCenter;
            GUI.Label(container, "\n\nClick 'Add' to create some", centered);
            centered.fontStyle = FontStyle.Bold;
            GUI.Label(container, "No " + scope.ToString() + " " + type.ToString() + " found.\n\n", centered);
        }
Esempio n. 7
0
		private static string substituteStringVariable(string input, VariableEditorScopes scope, VariableEditorTypes type, int dialogueId){
			
			string output = string.Empty;
			
			string[] subStartString = new string[]{"<"+scopeStrings[scope]+typeStrings[type]+">"};
			string[] subEndString = new string[]{"</"+scopeStrings[scope]+typeStrings[type]+">"};
			
			
			//char[] subStartChars = new char[4]{'<',scopeStrings[scope],typeStrings[type],'>'};
			//char[] subEndChars = new char[5]{'<','/',scopeStrings[scope],typeStrings[type],'>'};
			
			//Debug.Log ("[DialoguerUtils] startString: "+string.Join("",subStartString)+" - endString: "+string.Join("",subEndString));
			
			string[] pieces = input.Split(subStartString, StringSplitOptions.None);
			
			//Debug.Log ("[DialoguerUtils] pieces count: "+pieces.Length+" - (should be 2)");
			
			for(int i = 0; i<pieces.Length; i+=1){
				string[] subPieces = pieces[i].Split(subEndString, StringSplitOptions.None);
				
				//Debug.Log("[DialoguerUtils] subPieces[0] = "+subPieces[0]);
				
				int variableId;
				bool success = int.TryParse(subPieces[0], out variableId);
				if(success){
					switch(scope){
						case VariableEditorScopes.Global:
							switch(type){
								case VariableEditorTypes.Boolean:
									subPieces[0] = Dialoguer.GetGlobalBoolean(variableId).ToString();
								break;
							
								case VariableEditorTypes.Float:
									subPieces[0] = Dialoguer.GetGlobalFloat(variableId).ToString();
								break;
							
								case VariableEditorTypes.String:
									subPieces[0] = Dialoguer.GetGlobalString(variableId);
								break;
							}
						break;
							
						case VariableEditorScopes.Local:
							Debug.Log("Local Variable string substitutions not yet supported");
							switch(type){
								case VariableEditorTypes.Boolean:
									
								break;
							
								case VariableEditorTypes.Float:
									
								break;
							
								case VariableEditorTypes.String:
									
								break;
							}
						break;
					}
				}else{
					//subPieces[0] = "_invalid_variable_id_";
				}
				
				output += string.Join("", subPieces);
			}
			
			return output;
		}
        // VARIABLE EDITOR RE-USABLE GUI
        public static void drawEditorBase(Rect container, DialogueEditorVariablesContainer variables, VariableEditorScopes scope, VariableEditorTypes type)
        {
            bool isPro = EditorGUIUtility.isProSkin;

            int boxHeight = 63;

            string targetName = scope.ToString() + " " + type.ToString();

            Rect topRect    = new Rect(container.x, container.y, container.width, boxHeight);
            Rect bottomRect = new Rect(container.x, container.y + container.height - boxHeight, container.width, boxHeight);

            if (isPro)
            {
                DialogueEditorGUI.drawShadowedRect(topRect, 2);
                DialogueEditorGUI.drawShadowedRect(bottomRect, 2);
            }
            else
            {
                GUI.Box(topRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
                GUI.Box(bottomRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
                GUI.Box(topRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
                GUI.Box(bottomRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
            }

            GUIStyle titleStyle = new GUIStyle("label");

            titleStyle.fontStyle = FontStyle.Bold;
            titleStyle.padding   = new RectOffset(5, titleStyle.padding.right, titleStyle.padding.top - 2, titleStyle.padding.bottom);
            titleStyle.alignment = TextAnchor.MiddleLeft;

            Rect topTitleRect = new Rect(topRect.x + 5, topRect.y + 5, topRect.width - 10, 22);

            if (isPro)
            {
                DialogueEditorGUI.drawShadowedRect(topTitleRect, 2);
            }
            else
            {
                GUI.Box(topTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
                GUI.Box(topTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
            }
            GUI.Label(topTitleRect, targetName + " Name", titleStyle);

            Rect bottomTitleRect = new Rect(bottomRect.x + 5, bottomRect.y + 5, bottomRect.width - 10, 22);

            if (isPro)
            {
                DialogueEditorGUI.drawShadowedRect(bottomTitleRect, 2);
            }
            else
            {
                GUI.Box(bottomTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
                GUI.Box(bottomTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
            }
            GUI.Label(bottomTitleRect, targetName + " Value", titleStyle);

            Rect nameTextFieldRect = new Rect(topTitleRect.x + 2, topTitleRect.y + topTitleRect.height + 5 + 1, topTitleRect.width - 4, 22);

            if (isPro)
            {
                DialogueEditorGUI.drawHighlightRect(nameTextFieldRect, 1, 1);
            }
            else
            {
                GUI.Box(DialogueEditorGUI.getOutlineRect(nameTextFieldRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset"));
            }
            variables.variables[variables.selection].name = GUI.TextField(nameTextFieldRect, variables.variables[variables.selection].name, largeTextFieldStyle());
        }
 public void init()
 {
     __scope          = VariableEditorScopes.Global;
     __type           = VariableEditorTypes.Boolean;
     __scrollPosition = Vector2.zero;
 }
		// NO-VARIABLES WARNING
		public static void drawNoVariablesWarning(Rect container, VariableEditorScopes scope, VariableEditorTypes type){
			if(EditorGUIUtility.isProSkin){
				DialogueEditorGUI.drawShadowedRect(container, 2);
			}else{
				GUI.Box(container, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
				GUI.Box(container, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
			}
			GUIStyle centered = new GUIStyle("label");
			centered.alignment = TextAnchor.MiddleCenter;
			GUI.Label(container, "\n\nClick 'Add' to create some",centered);
			centered.fontStyle = FontStyle.Bold;
			GUI.Label(container, "No "+scope.ToString()+" "+type.ToString()+" found.\n\n",centered);
		}
		// VARIABLE EDITOR RE-USABLE GUI
		public static void drawEditorBase(Rect container, DialogueEditorVariablesContainer variables, VariableEditorScopes scope, VariableEditorTypes type){
			
			bool isPro = EditorGUIUtility.isProSkin;
			
			int boxHeight = 63;
			
			string targetName = scope.ToString() + " " + type.ToString();
			
			Rect topRect = new Rect(container.x, container.y, container.width, boxHeight);
			Rect bottomRect = new Rect(container.x, container.y + container.height - boxHeight, container.width, boxHeight);
			if(isPro){
				DialogueEditorGUI.drawShadowedRect(topRect, 2);
				DialogueEditorGUI.drawShadowedRect(bottomRect, 2);
			}else{
				GUI.Box(topRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
				GUI.Box(bottomRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
				GUI.Box(topRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
				GUI.Box(bottomRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
			}
			
			GUIStyle titleStyle = new GUIStyle("label");
			titleStyle.fontStyle = FontStyle.Bold;
			titleStyle.padding = new RectOffset(5, titleStyle.padding.right, titleStyle.padding.top - 2, titleStyle.padding.bottom);
			titleStyle.alignment = TextAnchor.MiddleLeft;
			
			Rect topTitleRect = new Rect(topRect.x + 5, topRect.y + 5, topRect.width - 10, 22);
			if(isPro){
				DialogueEditorGUI.drawShadowedRect(topTitleRect, 2);
			}else{
				GUI.Box(topTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
				GUI.Box(topTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
			}
			GUI.Label(topTitleRect, targetName + " Name", titleStyle);
			
			Rect bottomTitleRect = new Rect(bottomRect.x + 5, bottomRect.y + 5, bottomRect.width - 10, 22);
			if(isPro){
				DialogueEditorGUI.drawShadowedRect(bottomTitleRect, 2);
			}else{
				GUI.Box(bottomTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
				GUI.Box(bottomTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset"));
			}
			GUI.Label(bottomTitleRect, targetName + " Value", titleStyle);
			
			Rect nameTextFieldRect = new Rect(topTitleRect.x + 2,topTitleRect.y + topTitleRect.height + 5 + 1,topTitleRect.width - 4,22);
			if(isPro){
				DialogueEditorGUI.drawHighlightRect(nameTextFieldRect, 1, 1);
			}else{
				GUI.Box(DialogueEditorGUI.getOutlineRect(nameTextFieldRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset"));
			}
			variables.variables[variables.selection].name = GUI.TextField(nameTextFieldRect, variables.variables[variables.selection].name, largeTextFieldStyle());
			
		}
	public void init(){
		__scope = VariableEditorScopes.Global;
		__type = VariableEditorTypes.Boolean;
		__scrollPosition = Vector2.zero;
	}
	private void setTarget(VariableEditorScopes scope, VariableEditorTypes type){
		if(__scope == scope && __type == type) return;
		getVariables().selection = 0;
		__scope = scope;
		__type = type;
	}
Esempio n. 14
0
        private static string substituteStringVariable(string input, VariableEditorScopes scope, VariableEditorTypes type, int dialogueId)
        {
            string output = string.Empty;

            string[] subStartString = new string[] { "<" + scopeStrings[scope] + typeStrings[type] + ">" };
            string[] subEndString   = new string[] { "</" + scopeStrings[scope] + typeStrings[type] + ">" };


            //char[] subStartChars = new char[4]{'<',scopeStrings[scope],typeStrings[type],'>'};
            //char[] subEndChars = new char[5]{'<','/',scopeStrings[scope],typeStrings[type],'>'};

            //Debug.Log ("[DialoguerUtils] startString: "+string.Join("",subStartString)+" - endString: "+string.Join("",subEndString));

            string[] pieces = input.Split(subStartString, StringSplitOptions.None);

            //Debug.Log ("[DialoguerUtils] pieces count: "+pieces.Length+" - (should be 2)");

            for (int i = 0; i < pieces.Length; i += 1)
            {
                string[] subPieces = pieces[i].Split(subEndString, StringSplitOptions.None);

                //Debug.Log("[DialoguerUtils] subPieces[0] = "+subPieces[0]);

                int  variableId;
                bool success = int.TryParse(subPieces[0], out variableId);
                if (success)
                {
                    switch (scope)
                    {
                    case VariableEditorScopes.Global:
                        switch (type)
                        {
                        case VariableEditorTypes.Boolean:
                            subPieces[0] = Dialoguer.GetGlobalBoolean(variableId).ToString();
                            break;

                        case VariableEditorTypes.Float:
                            subPieces[0] = Dialoguer.GetGlobalFloat(variableId).ToString();
                            break;

                        case VariableEditorTypes.String:
                            subPieces[0] = Dialoguer.GetGlobalString(variableId);
                            break;
                        }
                        break;

                    case VariableEditorScopes.Local:
                        Debug.Log("Local Variable string substitutions not yet supported");
                        switch (type)
                        {
                        case VariableEditorTypes.Boolean:

                            break;

                        case VariableEditorTypes.Float:

                            break;

                        case VariableEditorTypes.String:

                            break;
                        }
                        break;
                    }
                }
                else
                {
                    //subPieces[0] = "_invalid_variable_id_";
                }

                output += string.Join("", subPieces);
            }

            return(output);
        }