Esempio n. 1
0
		internal override void PassClosingTag(ElementTypes ElementType)
		{
			this.xmlReader.Read();
#if DEBUG
			if (this.xmlReader.NodeType != XmlNodeType.EndElement
					|| this.xmlReader.Name != XmlSerializationFormatter.XmlElementNames[(int)ElementType])
				throw new Exception(
					string.Format("Unattended xml element {0} while waiting a closing tag {1}", xmlReader.Name, ElementType.ToString()));
#endif
		}
Esempio n. 2
0
		// ------------------------------

		internal override void PassClosingTag(ElementTypes ElementType)
		{
			this.GetNextJSONPart();
			if (this._JSONReader.Name == JSONSerializationFormatter.DataEndMarkTag)
			{
				this.WeAlreadyObtainedJSONPart = true;
				return;
			}
#if DEBUG
			if (this._JSONReader.NodeType != XmlNodeType.EndElement
					|| this._JSONReader.Name != JSONSerializationFormatter.JSONElementNames[(int)ElementType])
				throw new Exception(
					string.Format("Unattended JSON element {0} while waiting a closing tag {1}", _JSONReader.Name, ElementType.ToString()));
#endif
		}
    public override void OnInspectorGUI()
    {
        // emptyTexture = (Texture)EditorGUIUtility.Load("Assets/EditorDefaultResources/empty.png");

        base.OnInspectorGUI();
        GUILayout.Label("Current Selected : " + currentSelected.ToString());

        LevelCreator levelCreator = (LevelCreator)target;
        int          rows         = (int)Mathf.Sqrt(levelCreator.level.Count);

        //int currentI = levelCreator.level.Count-1;
        GUILayout.BeginVertical();
        for (int r = rows - 1; r >= 0; r--)
        {
            GUILayout.BeginHorizontal();
            for (int c = 0; c < rows; c++)
            {
                if (GUILayout.Button(textureHolder[levelCreator.level[c + ((rows) * r)]], GUILayout.Width(50), GUILayout.Height(50)))
                {
                    levelCreator.level[c + ((rows) * r)] = currentSelected;
                }
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();

        GUILayout.Space(20);
        GUILayout.BeginVertical();
        GUILayout.BeginHorizontal();
        int count = 0;

        foreach (KeyValuePair <ElementTypes, Texture> e in textureHolder)
        {
            count++;
            if (GUILayout.Button(e.Value, GUILayout.Width(50), GUILayout.Height(50)))
            {
                currentSelected = e.Key;
            }
            if (count % 4 == 0)
            {
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
            }
        }

        GUILayout.EndVertical();

        /* if (GUILayout.Button(textureHolder[ElementTypes.Empty],GUILayout.Width(50),GUILayout.Height(50))){
         *   currentSelected = ElementTypes.Empty;
         * }
         * else if (GUILayout.Button(textureHolder[ElementTypes.Baba], GUILayout.Width(50), GUILayout.Height(50)))
         * {
         *   currentSelected = ElementTypes.Baba;
         * }
         * else if (GUILayout.Button(textureHolder[ElementTypes.Wall], GUILayout.Width(50), GUILayout.Height(50)))
         * {
         *   currentSelected = ElementTypes.Wall;
         * }
         * else if (GUILayout.Button("Rock"))
         * {
         *   currentSelected = ElementTypes.Rock;
         * }
         * else if (GUILayout.Button("Flag"))
         * {
         *   currentSelected = ElementTypes.Flag;
         * }
         * else if (GUILayout.Button("Goop"))
         * {
         *   currentSelected = ElementTypes.Goop;
         * }
         * else if (GUILayout.Button("Is"))
         * {
         *   currentSelected = ElementTypes.IsWord;
         * }
         * else if (GUILayout.Button("BabaWord"))
         * {
         *   currentSelected = ElementTypes.BabaWord;
         * }
         * else if (GUILayout.Button("WallWord"))
         * {
         *   currentSelected = ElementTypes.WallWord;
         * }
         * else if (GUILayout.Button("FlagWord"))
         * {
         *   currentSelected = ElementTypes.FlagWord;
         * }
         * else if (GUILayout.Button("RockWord"))
         * {
         *   currentSelected = ElementTypes.RockWord;
         * }
         * else if (GUILayout.Button("YouWord"))
         * {
         *   currentSelected = ElementTypes.YouWord;
         * }
         * else if (GUILayout.Button("PushWord"))
         * {
         *   currentSelected = ElementTypes.PushWord;
         * }
         * else if (GUILayout.Button("WinWord"))
         * {
         *   currentSelected = ElementTypes.WinWord;
         * }
         * else if (GUILayout.Button("StopWord"))
         * {
         *   currentSelected = ElementTypes.StopWord;
         * }*/
    }
Esempio n. 4
0
 public static String StringFromElementType(ElementTypes elementType)
 {
     return elementType.ToString();
 }
Esempio n. 5
0
 /// <summary>
 /// Produces a string representation of the constraint token [Constraint: {ElementType}]
 /// </summary>
 /// <returns>A string.</returns>
 public override string ToString()
 {
     return($"[Constraint: {_constraint.ToString()}]");
 }
Esempio n. 6
0
        internal override void PassClosingTag(ElementTypes ElementType)
        {
            this.xmlReader.Read();
#if DEBUG
            if (this.xmlReader.NodeType != XmlNodeType.EndElement ||
                this.xmlReader.Name != XmlSerializationFormatter.XmlElementNames[(int)ElementType])
            {
                throw new Exception(
                          string.Format("Unattended xml element {0} while waiting a closing tag {1}", xmlReader.Name, ElementType.ToString()));
            }
#endif
        }
Esempio n. 7
0
        // ------------------------------

        internal override void PassClosingTag(ElementTypes ElementType)
        {
            this.GetNextJSONPart();
            if (this._JSONReader.Name == JSONSerializationFormatter.DataEndMarkTag)
            {
                this.WeAlreadyObtainedJSONPart = true;
                return;
            }
#if DEBUG
            if (this._JSONReader.NodeType != XmlNodeType.EndElement ||
                this._JSONReader.Name != JSONSerializationFormatter.JSONElementNames[(int)ElementType])
            {
                throw new Exception(
                          string.Format("Unattended JSON element {0} while waiting a closing tag {1}", _JSONReader.Name, ElementType.ToString()));
            }
#endif
        }