Пример #1
0
        //public void Handle(FontFamily message)
        //{
        //    editor.FontFamily = message;
        //}

        public void Initialize(ScriptedObjectInfo info)
        {
            SqlText          = info.ObjectDefinition;
            _originalSqlText = info.ObjectDefinition;
            TypeDescription  = info.DbObject.type_desc;
            DisplayName      = info.DbObject.full_name;
            CanonicalName    = info.DbObject.LongDescription;
            NotifyOfPropertyChange(() => Title);
        }
Пример #2
0
	// because the scripted objects thenselves are generally not created from serialized data when the game is run,
	// but rather instantiated from prefabs or placed in the level or asset bundle, these serialize routines
	// may not really matter.  The individual interaction scripts/actions, however, really do have to be right!!
	public ScriptedObjectInfo ToInfo(ScriptedObject so){ // saves values to an info for serialization (to XML)
		ScriptedObjectInfo info = new ScriptedObjectInfo();
		
		info.unityObjectName = so.name;

		info.moveToParentOnDrop = so.moveToParentOnDrop; // set this in each prefab, but false so constructed ones dont
		info.dropTargetName = so.dropTargetName;
		info.scripts = new InteractionScript.InteractionScriptInfo[so.scripts.Length];
		for (int i = 0; i<so.scripts.Length; i++){
			if (so.scripts[i] != null){
				info.scripts[i] = so.scripts[i].ToInfo(so.scripts[i]);
			}
			else 
			{
				Debug.Log("Scripted Boject "+so.name+"contains null script at index "+i);
#if UNITY_EDITOR
				EditorUtility.DisplayDialog("Save Failed","Scripted Boject "+so.name+"contains null script at index "+i,"OK");
#endif
			}			
		}
		if (so.startupScript != null)
			info.startupScriptName = so.startupScript.name;
		info.register = so.register; // instead, derive this from any contained scripts who listen to status messages
		info.prettyname = so.prettyname; // this was on the OI class, we shouldnt need it here
		info.XMLName = so.XMLName;
		info.XMLDirectory = so.XMLDirectory;
		
		info.assetBundleInfo = so.assetBundleInfo;
		info.voiceList = so.voiceList;
		info.voiceLists = so.voiceLists;
		info.vitalsBehaviors = so.vitalsBehaviors;
		info.scanRecords = so.scanRecords;
	
		return info;
	}
Пример #3
0
	public void AppendFrom(ScriptedObjectInfo info){
		// make children from all the scriptInfos, and init each one from it's info, which will build the Actions
		int hadScripts = scripts.Length;
		// append my scripts to the parent's ScriptedObject
		InteractionScript[] tmp = new InteractionScript[hadScripts];
		for (int i = 0; i< hadScripts; i++)
			tmp[i] = scripts[i];
		
		// since you can't extend an array, copy the old one here, create a new one, and copy back 
		scripts = new InteractionScript[hadScripts + info.scripts.Length];
		for (int i = 0; i< hadScripts; i++)
			scripts[i] = tmp[i];
		for (int i = 0; i< info.scripts.Length; i++){
			GameObject go = new GameObject(info.scripts[i].unityObjectName);
			go.transform.parent = this.transform;
			scripts[i+hadScripts] = go.AddComponent("InteractionScript") as InteractionScript;
			scripts[i+hadScripts].InitFrom(info.scripts[i]);	
		}
		// see if there's a startup script to link
		if (info.startupScriptName != null && info.startupScriptName != ""){
			for (int i = 0; i<scripts.Length; i++){
				if (scripts[i].name == info.startupScriptName){
					startupScript = scripts[i];
					break;
				}
			}
		}
	}	
Пример #4
0
	public void LinkFrom(ScriptedObjectInfo info){
		// 	initialize members from deserialized info
		gameObject.name = info.unityObjectName;
		moveToParentOnDrop = info.moveToParentOnDrop; // set this in each prefab, but false so constructed ones dont
		dropTargetName = info.dropTargetName;

		// don't process the scripts in this method
		
		register = info.register; // instead, derive this from any contained scripts who listen to status messages
		prettyname = info.prettyname; // this was on the OI class, we shouldnt need it here
		XMLName = info.XMLName;
		XMLDirectory = info.XMLDirectory;
		assetBundleInfo = info.assetBundleInfo;
		voiceList = info.voiceList;
		voiceLists = info.voiceLists;
		vitalsBehaviors = info.vitalsBehaviors;
		scanRecords = info.scanRecords;
		
	}
Пример #5
0
	public void InitFrom(ScriptedObjectInfo info){
		// we should probably destroy any existing hierarchy here, calling OnDestroy() on our children;
		
		// 	initialize members from deserialized info
		gameObject.name = info.unityObjectName;
		
		moveToParentOnDrop = info.moveToParentOnDrop; // set this in each prefab, but false so constructed ones dont
		dropTargetName = info.dropTargetName;
		// make children from all the scriptInfos, and init each one from it's info, which will build the Actions
		scripts = new InteractionScript[info.scripts.Length];
		for (int i = 0; i<info.scripts.Length; i++){
			GameObject go = new GameObject(info.scripts[i].unityObjectName);
			go.transform.parent = this.transform;
			scripts[i] = go.AddComponent("InteractionScript") as InteractionScript;
			scripts[i].InitFrom(info.scripts[i]);	
		}
		if (info.startupScriptName != null && info.startupScriptName != ""){
			for (int i = 0; i<scripts.Length; i++){
				if (scripts[i].name == info.startupScriptName){
					startupScript = scripts[i];
					break;
				}
			}
		}
		
		register = info.register; // instead, derive this from any contained scripts who listen to status messages
		prettyname = info.prettyname; // this was on the OI class, we shouldnt need it here
		XMLName = info.XMLName;
		XMLDirectory = info.XMLDirectory;
		assetBundleInfo = info.assetBundleInfo;
		voiceList = info.voiceList;
		voiceLists = info.voiceLists;
		vitalsBehaviors = info.vitalsBehaviors;
		scanRecords = info.scanRecords;
	}