public virtual void AtEnd()
    {
		animateState = eAnimateState.STOP;
		if(isVerbose)
		{
			Brain brain = Brain.GetInstance();
			AnimateMsg msg = new AnimateMsg(gameObject.name, animateState);
			brain.PutMessage(msg);
		}		
    }
示例#2
0
	public AnimateMsg(string objectName, eAnimateState state) : base()
	{
		this.name = objectName;
		this.state = state;
	}
示例#3
0
	public bool ShowInspectorGUI(){
		// this is called from the ScriptedAction custom inspector, and only shows the fields needed for the selected type
		bool dirty = false;
		if (serializedObject == null) serializedObject = new SerializedObject(this); // needed to display arrays in editor like fashion
		msgType = (eMsgType)EditorGUILayout.EnumPopup("msgType",(Enum)msgType);
		EditorGUI.BeginChangeCheck();
		if (msgType == eMsgType.interactMsg){
			if (gameObjectName == null) gameObjectName = "";
			gameObjectName = EditorGUILayout.TextField("gameObject",gameObjectName);
			if (map != null) dirty |= map.ShowInspectorGUI("map");		
			log = EditorGUILayout.Toggle("log",log);
		}
		if (msgType == eMsgType.interactStatusMsg){
			if (gameObjectName == null) gameObjectName = "";
			gameObjectName = EditorGUILayout.TextField("gameObject",gameObjectName);
			sendMap = EditorGUILayout.Toggle("send Map?",sendMap);
			if (sendMap && map != null) 
				dirty |= map.ShowInspectorGUI("map");		
			else
				interactName = EditorGUILayout.TextField("interactName",interactName);
			log = EditorGUILayout.Toggle("log",log);
			
			// to show a string array in the editor:
			serializedObject.Update();
    		EditorGUIUtility.LookLikeInspector();
    		SerializedProperty myIterator = serializedObject.FindProperty("Params");
   			while (true){
        	Rect myRect = GUILayoutUtility.GetRect(0f, 16f);
        	bool showChildren = EditorGUI.PropertyField(myRect, myIterator);
			if (!myIterator.NextVisible(showChildren)) break;
			}
    		serializedObject.ApplyModifiedProperties()	;
			EditorGUIUtility.LookLikeControls();
			
		}
		if (msgType == eMsgType.animateMsg){
			state = (eAnimateState)EditorGUILayout.EnumPopup("state",(Enum)state);
			if (name == null) name = "";
			name = EditorGUILayout.TextField("name",name);
		}
		if (msgType == eMsgType.taskMsg){
			
		}
		if (msgType == eMsgType.dialogMsg 
			|| msgType == eMsgType.errorDialogMsg 
			|| msgType == eMsgType.quickInfoDialogMsg
			|| msgType == eMsgType.popupMsg )
		{
			command = (DialogMsg.Cmd)EditorGUILayout.EnumPopup("command",(Enum)command);
			x = EditorGUILayout.IntField("x",x);
			y = EditorGUILayout.IntField("y",y);
			w = EditorGUILayout.IntField("w",w);
			h = EditorGUILayout.IntField("h",h);
			text = EditorGUILayout.TextField("text",text);	
			title = EditorGUILayout.TextField("title",title);
			time = EditorGUILayout.FloatField("time",time);
			modal = EditorGUILayout.Toggle("modal",modal);
		}
		if (msgType == eMsgType.dialogMsg) 
		{
			if (xmlName == null) xmlName = "";
			xmlName = EditorGUILayout.TextField ("xmlName",xmlName);
			if (className == null) className = "";
			className = EditorGUILayout.TextField("className",className);
			dialogName = EditorGUILayout.TextField("dialogName",dialogName);
			waitForDialogClosed = EditorGUILayout.Toggle("waitForDialogClosed",waitForDialogClosed);
			if ( waitForDialogClosed == true )
				waitForDialogName = EditorGUILayout.TextField("waitForDalogName",waitForDialogName);
			anchor = EditorGUILayout.TextField("anchor",anchor);
			numArguments = EditorGUILayout.IntField("numArguments",numArguments);
			// display number of arguments...change number of fields on change
			if (arguments.Count != numArguments )
			{
				List<string> newlist = new List<string>();
				if ( numArguments > arguments.Count )
				{
					// new is greater than current...just copy old to new
					foreach( string arg in arguments )
						newlist.Add(arg);
					// add blank(s) at the end
					for( int i=0 ; i<(numArguments-arguments.Count) ; i++)
						newlist.Add("");
				}
				else
				{
					// new is less than current...just copy old-1 to new
					foreach( string arg in arguments )
					{
						if ( newlist.Count < numArguments )
							newlist.Add(arg);
					}
				}
				// reassign
				arguments = newlist;
			}
			for (int i=0 ; i<arguments.Count ; i++)
			{
				arguments[i] = EditorGUILayout.TextField ("argument" + (i+1).ToString (),arguments[i]);
			}
		}
		if (msgType == eMsgType.guiScreenMsg) 
		{
			if (ScreenName == null) ScreenName = "";
			ScreenName = EditorGUILayout.TextField ("xmlName",ScreenName);
			numArguments = EditorGUILayout.IntField("numArguments",numArguments);
			// display number of arguments...change number of fields on change
			if (arguments.Count != numArguments )
			{
				List<string> newlist = new List<string>();
				if ( numArguments > arguments.Count )
				{
					// new is greater than current...just copy old to new
					foreach( string arg in arguments )
						newlist.Add(arg);
					// add blank(s) at the end
					for( int i=0 ; i<(numArguments-arguments.Count) ; i++)
						newlist.Add("");
				}
				else
				{
					// new is less than current...just copy old-1 to new
					foreach( string arg in arguments )
					{
						if ( newlist.Count < numArguments )
							newlist.Add(arg);
					}
				}
				// reassign
				arguments = newlist;
			}
			for (int i=0 ; i<arguments.Count ; i++)
			{
				arguments[i] = EditorGUILayout.TextField ("argument" + (i+1).ToString (),arguments[i]);
			}
		}
		
		
		
		if (msgType == eMsgType.errorDialogMsg){
			
		}
		if (msgType == eMsgType.interactDialogMsg){
			
		}
		if (msgType == eMsgType.quickInfoDialogMsg){
			timeout = EditorGUILayout.FloatField("timeout",timeout);
			editbox = EditorGUILayout.Toggle("editbox",editbox);
			if (editboxlabel == null) editboxlabel = "";
			editboxlabel = EditorGUILayout.TextField("editboxlabel",editboxlabel);
			if (editboxprompt == null) editboxprompt = "";
			editboxprompt = EditorGUILayout.TextField("editboxprompt",editboxprompt);
		}
		if (msgType == eMsgType.popupMsg){
			hasCancel = EditorGUILayout.Toggle("hasCancel",hasCancel);
			if (commandString == null) commandString = "";
			commandString = EditorGUILayout.TextField("commandString",commandString);
		}

		dirty |= EditorGUI.EndChangeCheck();
		if (dirty) EditorUtility.SetDirty(this);
		return dirty;
	}