예제 #1
0
        private void StopElement(string name)
        {
            Type clazz = (Type)CollectionUtils.Get(change, name.ToLower());

            if (clazz != null && clazz.Equals(this.curClass))
            {
                this.currentDefinitionObject.DefinitionObjectDidFinishParsing();
                if (this.currentDefinitionObject.parentDefinitionObject != null)
                {
                    this.currentDefinitionObject.parentDefinitionObject.ChildDefinitionObjectDidFinishParsing(this.currentDefinitionObject);
                }
                this.currentDefinitionObject = this.currentDefinitionObject.parentDefinitionObject;
                if (this.currentDefinitionObject != null)
                {
                    this.curClass = this.currentDefinitionObject.GetType();
                    this.isCurrentElementDefined = true;
                }
                else
                {
                    this.curClass = null;
                    this.isCurrentElementDefined = false;
                }
            }
            else if (this.currentDefinitionObject != null)
            {
                this.currentDefinitionObject.UndefinedElementDidFinish(name);
            }
        }
예제 #2
0
 private void StopElement(string name)
 {
     Type clazz = (Type)CollectionUtils.Get(change, name.ToLower());
     if (clazz != null && clazz.Equals(this.curClass))
     {
         this.currentDefinitionObject.DefinitionObjectDidFinishParsing();
         if (this.currentDefinitionObject.parentDefinitionObject != null)
         {
             this.currentDefinitionObject.parentDefinitionObject.ChildDefinitionObjectDidFinishParsing(this.currentDefinitionObject);
         }
         this.currentDefinitionObject = this.currentDefinitionObject.parentDefinitionObject;
         if (this.currentDefinitionObject != null)
         {
             this.curClass = this.currentDefinitionObject.GetType();
             this.isCurrentElementDefined = true;
         }
         else
         {
             this.curClass = null;
             this.isCurrentElementDefined = false;
         }
     }
     else if (this.currentDefinitionObject != null)
     {
         this.currentDefinitionObject.UndefinedElementDidFinish(name);
     }
 }
예제 #3
0
 public virtual void Load(string resName)
 {
     this._path = resName;
     this._classType = null;
     this._source = null;
     this.currentDefinitionObject = null;
     this.isCurrentElementDefined = false;
     XMLParser.Parse(resName, listener);
 }
예제 #4
0
 public virtual void Load(InputStream res)
 {
     this._path      = null;
     this._classType = null;
     this._source    = null;
     this.currentDefinitionObject = null;
     this.isCurrentElementDefined = false;
     XMLParser.Parse(res, listener);
 }
예제 #5
0
 public virtual void Load(InputStream res)
 {
     this._path = null;
     this._classType = null;
     this._source = null;
     this.currentDefinitionObject = null;
     this.isCurrentElementDefined = false;
     XMLParser.Parse(res, listener);
 }
예제 #6
0
 public virtual void Load(string resName)
 {
     this._path      = resName;
     this._classType = null;
     this._source    = null;
     this.currentDefinitionObject = null;
     this.isCurrentElementDefined = false;
     XMLParser.Parse(resName, listener);
 }
예제 #7
0
        private void StartElement(string name)
        {
            Type clazz = (Type)CollectionUtils.Get(change, name.ToLower());

            if (clazz != null)
            {
                DefinitionObject childObject = null;
                try
                {
                    childObject = (DefinitionObject)JavaRuntime.NewInstance(clazz);
                    if (_source != null)
                    {
                        childObject.fileName = _source;
                    }
                }
                catch (Exception e)
                {
                    Loon.Utils.Debug.Log.Exception(e);
                }
                if (this.isCurrentElementDefined)
                {
                    childObject.InitWithParentObject(this.currentDefinitionObject);
                }
                childObject.DefinitionObjectDidInit();
                if (childObject.parentDefinitionObject != null)
                {
                    childObject.parentDefinitionObject.ChildDefinitionObjectDidInit(childObject);
                }
                this.curClass = clazz;
                this.currentDefinitionObject = childObject;
                this.isCurrentElementDefined = true;
            }
            else
            {
                this.isCurrentElementDefined = false;
                if (this.currentDefinitionObject != null)
                {
                    this.currentDefinitionObject.UndefinedElementDidStart(name);
                }
            }
        }
예제 #8
0
 public virtual void ChildDefinitionObjectDidFinishParsing(DefinitionObject childObject)
 {
 }
예제 #9
0
 private void StartElement(string name)
 {
     
     Type clazz = (Type)CollectionUtils.Get(change,name.ToLower());
     if (clazz != null)
     {
         DefinitionObject childObject = null;
         try
         {
             childObject = (DefinitionObject)JavaRuntime.NewInstance(clazz);
             if (_source != null)
             {
                 childObject.fileName = _source;
             }
         }
         catch (Exception e)
         {
             Loon.Utils.Debugging.Log.Exception(e);
         }
         if (this.isCurrentElementDefined)
         {
             childObject.InitWithParentObject(this.currentDefinitionObject);
         }
         childObject.DefinitionObjectDidInit();
         if (childObject.parentDefinitionObject != null)
         {
             childObject.parentDefinitionObject.ChildDefinitionObjectDidInit(childObject);
         }
         this.curClass = clazz;
         this.currentDefinitionObject = childObject;
         this.isCurrentElementDefined = true;
     }
     else
     {
         this.isCurrentElementDefined = false;
         if (this.currentDefinitionObject != null)
         {
             this.currentDefinitionObject.UndefinedElementDidStart(name);
         }
     }
 }
예제 #10
0
		public virtual void ChildDefinitionObject(DefinitionObject childObject, string str)
		{
		}
예제 #11
0
 public DefinitionObject InitWithParentObject(DefinitionObject parentObject)
 {
     this.parentDefinitionObject = parentObject;
     return(this);
 }
예제 #12
0
 public virtual void ChildDefinitionObjectDidInit(DefinitionObject childObject)
 {
 }
예제 #13
0
 public virtual void ChildDefinitionObject(DefinitionObject childObject, string str)
 {
 }
예제 #14
0
파일: DefImage.cs 프로젝트: zx8326123/LGame
        public override void DefinitionObjectDidReceiveString(string v)
        {
            base.DefinitionObjectDidReceiveString(v);
            List <string> result = GetResult(v);

            foreach (string list in result)
            {
                if (list.Length > 2)
                {
                    string[] values = StringUtils.Split(list, "=");
                    string   name   = values[0];
                    string   value  = values[1];
                    if ("imageid".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.uniqueID = value;
                    }
                    else if ("pos".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.pos = DefinitionObject.StrToVector2(value);
                    }
                    else if ("orig".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.orig = DefinitionObject.StrToVector2(value);
                    }
                    else if ("size".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.size = DefinitionObject.StrToVector2(value);
                    }
                    else if ("anchor".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.anchor = DefinitionObject.StrToVector2(value);
                    }
                    else if ("place".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.place = DefinitionObject.StrToVector2(value);
                    }
                    else if ("file".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.fileName = value;
                    }
                    else if ("name".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.uniqueID = value;
                    }
                    else if ("id".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.uniqueID = value;
                    }
                    else if ("mask".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        string[] colors = StringUtils.Split(value, ",");
                        if (colors.Length == 3)
                        {
                            this.maskColor = new LColor(Convert.ToInt32(colors[0]), Convert.ToInt32(colors[1]), Convert.ToInt32(colors[2]));
                        }
                        else if (colors.Length == 4)
                        {
                            this.maskColor = new LColor(Convert.ToInt32(colors[0]), Convert.ToInt32(colors[1]), Convert.ToInt32(colors[2]), Convert.ToInt32(colors[4]));
                        }
                    }
                    else if ("blend".Equals(name, System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        if ("non".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "NonPremultiplied".Equals(value, System.StringComparison.InvariantCultureIgnoreCase))
                        {
                            blend = BlendState.NonPremultiplied;
                        }
                        else if ("add".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "Additive".Equals(value, System.StringComparison.InvariantCultureIgnoreCase))
                        {
                            blend = BlendState.Additive;
                        }
                        else if ("alpha".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "AlphaBlend".Equals(value, System.StringComparison.InvariantCultureIgnoreCase))
                        {
                            blend = BlendState.AlphaBlend;
                        }
                        else if ("op".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "Opaque".Equals(value, System.StringComparison.InvariantCultureIgnoreCase))
                        {
                            blend = BlendState.Opaque;
                        }
                    }
                }
            }
            if (size == null && orig != null)
            {
                size = orig;
            }
            else if (orig == null && size != null)
            {
                orig = size;
            }
            if (anchor == null && size != null)
            {
                anchor = new Vector2f(size.x / 2, size.y / 2);
            }
            if (place == null)
            {
                place = new Vector2f();
            }
            result.Clear();
        }
예제 #15
0
		public DefinitionObject InitWithParentObject(DefinitionObject parentObject)
		{
			this.parentDefinitionObject = parentObject;
			return this;
		}
예제 #16
0
		public virtual void ChildDefinitionObjectDidInit(DefinitionObject childObject)
		{
		}
예제 #17
0
		public virtual void ChildDefinitionObjectDidFinishParsing(DefinitionObject childObject)
		{
		}