예제 #1
0
파일: Sprite.cs 프로젝트: RisaI/mff-totem
 /// <summary>
 /// Write full sprite info to JSON.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void ToJson(JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("asset");
     writer.WriteValue(_textureAsset);
     writer.WritePropertyName("fwidth");
     writer.WriteValue(_frameWidth);
     writer.WritePropertyName("fheight");
     writer.WriteValue(_frameHeight);
     writer.WritePropertyName("scale");
     writer.WriteVector2(Scale);
     writer.WritePropertyName("anchor");
     writer.WriteVector2(Anchor);
     writer.WritePropertyName("color");
     writer.WriteColor(Color);
     writer.WritePropertyName("effect");
     writer.WriteValue(Effect.ToString());
     writer.WritePropertyName("animregistry");
     writer.WriteStartObject();
     _animRegistry.ToList().ForEach(pair =>
     {
         writer.WritePropertyName(pair.Key);
         pair.Value.ToJson(writer);
     });
     writer.WriteEndObject();
     writer.WriteEndObject();
 }
예제 #2
0
        public override void Serialize(StreamWriter SW)
        {
            SW.WriteLine(ToString());

            base.Serialize(SW);
            if (Sprite != null)
            {
                Sprite.Serialize(SW, gameObject.Name);
            }
            else
            {
                SW.WriteLine("null\n"); // Make a check in deserialization
            }
            SW.Write("SpriteEffects:\t" + SpriteEffects.ToString() + "\n");
            SW.Write("Color:\t" + Color.R.ToString() + "\t" + Color.G.ToString() + "\t" + Color.B.ToString() + "\t" + Color.A.ToString() + "\n");
            if (Effect != null)
            {
                SW.Write("Effect:\t" + Effect.Name + "\n");
            }
            else
            {
                SW.Write("Effect:\t" + "null\n");
            }

            SW.WriteLine("End Of " + ToString());
        }
예제 #3
0
        public void Draw_with_SpriteEffects(SpriteEffects effects)
        {
            Game.DrawWith += (sender, e) => {
                _spriteBatch.Begin();
                _spriteBatch.DrawString(
                    _defaultFont, effects.ToString(), new Vector2(50, 50), Color.Orange,
                    0, Vector2.Zero, Vector2.One, effects, 0.0f);
                _spriteBatch.End();
            };

            RunSingleFrameTest();
        }
예제 #4
0
        public void Draw_with_SpriteEffects(SpriteEffects effects)
        {
            PrepareFrameCapture();

            _spriteBatch.Begin();
            // Row 0: String test.
            _spriteBatch.DrawString(
                _defaultFont, effects.ToString(), new Vector2(50, 50), Color.Orange,
                0, Vector2.Zero, 1f, effects, 0.0f);
            _spriteBatch.DrawString(
                _defaultFont, effects.ToString(), new Vector2(450, 50), Color.Orange,
                0, Vector2.Zero, Vector2.One, effects, 0.0f);
            // Row 1: StringBuilder test.
            _spriteBatch.DrawString(
                _defaultFont, new StringBuilder(effects.ToString()), new Vector2(50, 290), Color.Orange,
                0, Vector2.Zero, 1f, effects, 0.0f);
            _spriteBatch.DrawString(
                _defaultFont, new StringBuilder(effects.ToString()), new Vector2(450, 290), Color.Orange,
                0, Vector2.Zero, Vector2.One, effects, 0.0f);
            _spriteBatch.End();

            CheckFrames();
        }
예제 #5
0
 public void rec(string a, ref float r, Vector2 pv, Vector2 nv)
 {
     Main.NewText(a +
                  " Deg: " + ((int)d(rot)).ToString() +
                  /**" Rad: " + rot.ToString() +**/
                  " MinVect: " + (minVect).ToString() +
                  " R:" + d(r).ToString() +
                  " Q: " + qnt.ToString() +
                  " Mouth: " + pMth.ToString() +
                  " Egg: " + pEgg.ToString() +
                  " playerVel: " + pv.X.ToString() +
                  " broodVel: " + vel.ToString() +
                  " box: " + rand.ToString() +
                  " turbo: " + turbo.ToString() +
                  " phase: " + phase.ToString() +
                  " pTimer: " + pTimer[phase].ToString() +
                  " swpOrig: " + swpOrig.ToString() +
                  " swpStrt: " + swpStrt.ToString() +
                  " se: " + se.ToString() +
                  " pos: " + nv.ToString()
                  );
 }
예제 #6
0
		public void Draw_with_SpriteEffects (SpriteEffects effects)
		{
			Game.DrawWith += (sender, e) => {
				_spriteBatch.Begin ();
				_spriteBatch.DrawString (
					_defaultFont, effects.ToString(), new Vector2 (50, 50), Color.Orange,
					0, Vector2.Zero, Vector2.One, effects, 0.0f);
				_spriteBatch.End ();
			};

			RunSingleFrameTest ();
		}