/// <summary> /// Constructs a field from an xml definition node /// </summary> /// <param name="state"></param> /// <param name="s"></param> public Field(ProjectState state, IO.XmlStream s) { string temp = string.Empty; #region Type s.ReadAttribute("type", ref temp); typeIndex = state.Definition.GetTypeIndex(temp); Debug.Assert.If(typeIndex != -1, "Not a usable field type: {0}", temp); #endregion #region Name nameString = temp = XmlInterface.BuildEditorNameString(s); name = state.Compiler.Strings.Add(temp); #endregion #region Definition if (s.ReadAttributeOpt("definition", ref definition) || TypeIndexIsExplanation(state)) { SyncDefinitionWithState(state); } else if (state.Definition.FieldTypes[typeIndex].RequiresDefinition) { throw new Debug.ExceptionLog("\"{0}\" of type {1} has no definition", nameString, state.Definition.FieldTypes[typeIndex].Name); } #endregion }
protected ProjectState(BlamVersion engine, Project proj) { this.engine = engine; Managers.GameManager.Namespace nspace; Managers.GameManager.Platform plat; // Get the namespace of the engine we're using Managers.GameManager.FromBlamVersion(engine, out nspace, out plat); // Read the CheApe engine definition data we need for importing definition = new XmlInterface(engine); definition.Read(Managers.GameManager.GetRelativePath(nspace), "CheApe.xml"); InitializeTypeIndicies(); proj.OwnerState = this; project = proj; Managers.BlamDefinition gd = Program.GetManager(engine); (gd as Managers.IScriptingController).ScriptingCacheOpen(engine); scriptingInterface = gd[engine].GetResource <Scripting.XmlInterface>(Managers.BlamDefinition.ResourceScripts); }
protected ProjectState(BlamVersion engine, Project proj) { this.engine = engine; Managers.GameManager.Namespace nspace; Managers.GameManager.Platform plat; // Get the namespace of the engine we're using Managers.GameManager.FromBlamVersion(engine, out nspace, out plat); // Read the CheApe engine definition data we need for importing definition = new XmlInterface(engine); definition.Read(Managers.GameManager.GetRelativePath(nspace), "CheApe.xml"); InitializeTypeIndicies(); proj.OwnerState = this; project = proj; Managers.BlamDefinition gd = Program.GetManager(engine); (gd as Managers.IScriptingController).ScriptingCacheOpen(engine); scriptingInterface = gd[engine].GetResource<Scripting.XmlInterface>(Managers.BlamDefinition.ResourceScripts); }