private string getFormatFileName(SpriteID _id)
        {
            if (_id.ToString().StartsWith("C")) // quy ước các hình các lá bài bắt đầu bằng chữ C nên đừng sử dụng chữ c cho cái khác nữa
            {
                return("card\\" + _id.ToString().Substring(1));
            }
            if (_id.ToString().StartsWith("pha")) // quy ước các hình các lá bài bắt đầu bằng chữ C nên đừng sử dụng chữ c cho cái khác nữa
            {
                return("phase\\" + _id.ToString());
            }

            if (_id.ToString().StartsWith("B")) //Card Big
            {
                return("card_big\\" + _id.ToString().Substring(1));
            }
            if (_id.ToString().StartsWith("lp"))
            {
                return("General\\" + _id.ToString());
            }
            if (_id.ToString().StartsWith("font"))
            {
                return("font\\" + _id.ToString());
            }
            return(_id.ToString());
        }
 public MyObject(ContentManager _content, ID _id, SpriteID _spriteid)
 {
     Sprite = new Sprite(SpriteManager.getInstance(_content).GetSprite(_spriteid));
     Status = STATUS.NORMAL;
     ID = _id;
     m_timer = new Timer();
 }
Exemple #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="spriteId">ID number of the particle's sprite.</param>
 /// <param name="pos">Origin position of the particle.</param>
 /// <param name="scale">Scale of the particle.</param>
 /// <param name="speed">Speed at which the particle travels.</param>
 /// <param name="direction">Direction in which the particle travels.</param>
 /// <param name="timeOut"></param>
 public Particle(SpriteID spriteId, Vector2 pos, double scale, int speed, double direction, double timeOut)
     : base(spriteId, pos, scale)
 {
     this._speed = speed;
     this._direction = new Vector2((float)Math.Cos(direction), (float)Math.Sin(direction));
     this._timeOut = timeOut;
 }
    public void Add(SpriteID key, RefCountedSprite value)
    {
        lock (_dict)
        {
            LinkedListNode <KeyValuePair <SpriteID, RefCountedSprite> > node;

            if (_dict.TryGetValue(key, out node))
            {
                _list.Remove(node);
                _list.AddFirst(node);
            }
            else
            {
                node = new LinkedListNode <KeyValuePair <SpriteID, RefCountedSprite> >(
                    new KeyValuePair <SpriteID, RefCountedSprite>(key, value));

                _dict.Add(key, node);
                _list.AddFirst(node);
                value.AddReference();
            }

            if (_dict.Count > Max_Size)
            {
                var nodetoremove = _list.Last;
                if (nodetoremove != null)
                {
                    Remove(nodetoremove.Value.Key);
                }
            }
        }
    }
Exemple #5
0
 public MyObject(ContentManager _content, ID _id, SpriteID _spriteid)
 {
     Sprite  = new Sprite(SpriteManager.getInstance(_content).GetSprite(_spriteid));
     Status  = STATUS.NORMAL;
     ID      = _id;
     m_timer = new Timer();
 }
        private string getFormatFileName(SpriteID _id)
        {
            if (_id.ToString().StartsWith("C")) // quy ước các hình các lá bài bắt đầu bằng chữ C nên đừng sử dụng chữ c cho cái khác nữa
            {
                return ("card\\"+_id.ToString().Substring(1) );
            }
            if (_id.ToString().StartsWith("pha")) // quy ước các hình các lá bài bắt đầu bằng chữ C nên đừng sử dụng chữ c cho cái khác nữa
            {
                return ("phase\\" + _id.ToString());
            }

            if(_id.ToString().StartsWith("B")) //Card Big
            {
                return ("card_big\\" + _id.ToString().Substring(1));
            }
            if (_id.ToString().StartsWith("lp"))
            {
                return ("General\\" + _id.ToString());
            }
            if (_id.ToString().StartsWith("font"))
            {
                return ("font\\" + _id.ToString());
            }
            return _id.ToString();
        }
Exemple #7
0
 public ConfusionTouchAnswerInfo(SpriteID SpriteID, bool IsCorrect, AnswerID AnswerID, ColorEnum BalloonColor, ColorEnum TextInBalloon, ColorEnum TextColor)
 {
     this.SpriteID      = SpriteID;
     this.IsCorrect     = IsCorrect;
     this.AnswerID      = AnswerID;
     this.BalloonColor  = BalloonColor;
     this.TextInBalloon = TextInBalloon;
     this.TextColor     = TextColor;
 }
Exemple #8
0
 public Num(ContentManager _content, Vector2 _position, SpriteID _spriteid)
     : base(_content,ID.NUM,_spriteid)
 {
     this.m_position = _position;
     this.Sprite.Frame = new Rectangle(0, 0, Sprite.Texture.Width / 10, Sprite.Texture.Height);
     this.m_timer = new Timer();
     this.m_s_number = String.Empty;
     Action = null;
 }
Exemple #9
0
 public Num(ContentManager _content, Vector2 _position, SpriteID _spriteid)
     : base(_content, ID.NUM, _spriteid)
 {
     this.m_position   = _position;
     this.Sprite.Frame = new Rectangle(0, 0, Sprite.Texture.Width / 10, Sprite.Texture.Height);
     this.m_timer      = new Timer();
     this.m_s_number   = String.Empty;
     Action            = null;
 }
Exemple #10
0
 public Sprite(SpriteID id, String name, String textureFileName, Vector2 frameDimensions, int fps)
 {
     this._id = id;
     this._name = name;
     this._textureFileName = textureFileName;
     this._loaded = false;
     this._frameDimensions = frameDimensions;
     this._fps = fps;
     this._color = Color.White;
 }
 /// <summary>
 /// <param>Get Sprite thông qua Id </param>
 /// <param>Quy ước Id phải trùng với tên file hình, nếu không tồn tại id nào thì ném ngoại lệ</param>
 /// </summary>
 /// <param name="_id"></param>
 /// <returns></returns>
 public Sprite GetSprite(SpriteID _id)
 {
     try{
     return _listSprite[(int)_id];
     }
     catch
     {
         throw new Exception("Id: \'" + _id + "\' is not exists");
     }
 }
 /// <summary>
 /// <param>Get Sprite thông qua Id </param>
 /// <param>Quy ước Id phải trùng với tên file hình, nếu không tồn tại id nào thì ném ngoại lệ</param>
 /// </summary>
 /// <param name="_id"></param>
 /// <returns></returns>
 public Sprite GetSprite(SpriteID _id)
 {
     try{
         return(_listSprite[(int)_id]);
     }
     catch
     {
         throw new Exception("Id: \'" + _id + "\' is not exists");
     }
 }
 public Texture2D GetTexture(SpriteID _id)
 {
     try
     {
         return _listSprite[(int)_id].Texture;
     }
     catch
     {
         throw new Exception("Id: \'" + _id + "\' is not exists");
     }
 }
    public Sprite GetSpriteFromID(SpriteID ID)
    {
        Sprite sprite = GetSprite(ID);

        if (sprite == null)
        {
            sprite = GetSprite(SpriteID.DummySprite);
        }

        return(sprite);
    }
Exemple #15
0
 public static Sprite Get(SpriteID id)
 {
     foreach (Sprite g in graphics)
     {
         if (g.id.Equals(id))
         {
             return g;
         }
     }
     return null;
 }
Exemple #16
0
 public ButtonProperties(SpriteID image, List <SpriteID> secondaryImages, string ButtonText, AnswerID ID, Action <int, int, bool, List <SequenceOfClick> > OnClickAction, bool isCorrect, List <SequenceOfClick> SequenceInfo, Color ButtonTextColor)
 {
     this.image           = GetCorrectSpriteByID.Instance.GetSpriteFromID(image);
     this.secondaryImages = secondaryImages;
     this.ButtonText      = ButtonText;
     this.ButtonTextColor = ButtonTextColor;
     this.ID            = ID;
     this.isCorrect     = isCorrect;
     this.SequenceInfo  = SequenceInfo;
     this.OnClickAction = OnClickAction;
 }
 public Texture2D GetTexture(SpriteID _id)
 {
     try
     {
         return(_listSprite[(int)_id].Texture);
     }
     catch
     {
         throw new Exception("Id: \'" + _id + "\' is not exists");
     }
 }
    private Sprite GetSprite(SpriteID ID)
    {
        Sprite sprite = null;

        for (int i = 0; i < SpriteHolders.Count; i++)
        {
            if (ID == SpriteHolders [i].SpriteID)
            {
                sprite = SpriteHolders [i].Sprite;
                break;
            }
        }

        return(sprite);
    }
 public Sprite GetSprite(bool isSikpan, int num) //Rice, Soup
 {
     if (this.Category >= 3)
     {
         return(null);
     }
     if (isSikpan)
     {
         return(Resources.Load <Sprite>(foodPath + SpriteID.ToString() + "_S" + num.ToString()));
     }
     else
     {
         return(Resources.Load <Sprite>(foodPath + SpriteID.ToString() + "_T" + num.ToString()));
     }
 }
Exemple #20
0
    /// <summary>
    /// Gets the answer ID based on sprite ID.
    /// </summary>
    /// <returns>The answer IDB ased on sprite identifier.</returns>
    /// <param name="spriteID">Sprite identifier.</param>
    private AnswerID GetAnswerIDBasedOnSpriteID(SpriteID spriteID)
    {
        switch (spriteID)
        {
        case SpriteID.Balloon_Blue:
            return(AnswerID.Balloon_Blue);

        case SpriteID.Balloon_Green:
            return(AnswerID.Balloon_Green);

        case SpriteID.Balloon_Red:
            return(AnswerID.Balloon_Red);

        default:
            return(AnswerID.Balloon_Yellow);
        }
    }
Exemple #21
0
        public Card(ContentManager _content, ID _id, SpriteID _spriteId, eCardType _cardType)
            : base(_content, _id, _spriteId)
        {
            m_yellow_circle = new Sprite(SpriteManager.getInstance(_content).GetSprite(SpriteID.eff_y_circle));
            m_yellow_circle.Scale = new Vector2(0.2f);
            m_yellow_circle.Origin = new Vector2(m_yellow_circle.Size.X / 2, m_yellow_circle.Size.Y / 2);

            m_backsideTexture = SpriteManager.getInstance(_content).GetTexture(SpriteID.CBackSide);
            m_frontsideTexture = SpriteManager.getInstance(_content).GetTexture(_spriteId);
            //this.CanATK = true;
            this.IsFaceUp = true;
            this.CardType = _cardType;
            this.Button = new Button(this.Sprite);
            this.Button.Position = this.Position;
            this.Button.ButtonEvent += new Action(Button_DoActionClick);
            this.Button.RightClick += new Action(Button_OnRightClick);
            this.Hovered += new CardHoveredEventHandle(Card_Hovered);
        }
Exemple #22
0
        public Card(ContentManager _content, ID _id, SpriteID _spriteId, eCardType _cardType)
            : base(_content, _id, _spriteId)
        {
            m_yellow_circle        = new Sprite(SpriteManager.getInstance(_content).GetSprite(SpriteID.eff_y_circle));
            m_yellow_circle.Scale  = new Vector2(0.2f);
            m_yellow_circle.Origin = new Vector2(m_yellow_circle.Size.X / 2, m_yellow_circle.Size.Y / 2);

            m_backsideTexture  = SpriteManager.getInstance(_content).GetTexture(SpriteID.CBackSide);
            m_frontsideTexture = SpriteManager.getInstance(_content).GetTexture(_spriteId);
            //this.CanATK = true;
            this.IsFaceUp            = true;
            this.CardType            = _cardType;
            this.Button              = new Button(this.Sprite);
            this.Button.Position     = this.Position;
            this.Button.ButtonEvent += new Action(Button_DoActionClick);
            this.Button.RightClick  += new Action(Button_OnRightClick);
            this.Hovered            += new CardHoveredEventHandle(Card_Hovered);
        }
Exemple #23
0
        public Monster(ContentManager _content, SpriteID _spriteId, eCardType _cardType = eCardType.MONSTER)//cái tham số mặc nhiên để tạm
            : base(_content, ID.CARD, _spriteId, _cardType)
        {
            this.Original      = new MonsterCardData((MonsterCardData)CardProvider.GetInstance().GetCardById(_spriteId.ToString()));
            this.IsEffect      = Original.IsEffect;
            this.Attribute     = Original.Attribute;
            this.MonsterType   = Original.MonsterType;
            this.Level         = Original.Level;
            this.Atk           = Original.Atk;
            this.Def           = Original.Def;
            this.Rank          = Original.Rank;
            this.PendulumScale = Original.PendulumScale;
            this.SpellSpeed    = Original.SpellSpeed;
            this.CanATK        = true;

            this.num_atk   = new Num(_content, Vector2.Zero, SpriteID.font_710_whitenum);
            this.num_def   = new Num(_content, Vector2.Zero, SpriteID.font_710_whitenum);
            this.num_slash = new Num(_content, Vector2.Zero, SpriteID.font_710_whitenum);
        }
    public bool Remove(SpriteID key)
    {
        lock (_dict)
        {
            LinkedListNode <KeyValuePair <SpriteID, RefCountedSprite> > removednode;
            if (_dict.TryGetValue(key, out removednode))
            {
                _dict.Remove(key);
                _list.Remove(removednode);
                removednode.Value.Value.Release();
                return(true);
            }

            else
            {
                return(false);
            }
        }
    }
Exemple #25
0
        //cái tham số mặc nhiên để tạm
        public Monster(ContentManager _content, SpriteID _spriteId, eCardType _cardType = eCardType.MONSTER)
            : base(_content, ID.CARD, _spriteId, _cardType)
        {
            this.Original = new MonsterCardData((MonsterCardData)CardProvider.GetInstance().GetCardById(_spriteId.ToString()));
            this.IsEffect = Original.IsEffect;
            this.Attribute = Original.Attribute;
            this.MonsterType = Original.MonsterType;
            this.Level = Original.Level;
            this.Atk = Original.Atk;
            this.Def = Original.Def;
            this.Rank = Original.Rank;
            this.PendulumScale = Original.PendulumScale;
            this.SpellSpeed = Original.SpellSpeed;
            this.CanATK = true;

            this.num_atk = new Num(_content, Vector2.Zero, SpriteID.font_710_whitenum);
            this.num_def = new Num(_content, Vector2.Zero, SpriteID.font_710_whitenum);
            this.num_slash = new Num(_content, Vector2.Zero, SpriteID.font_710_whitenum);
        }
    public bool TryGetValue(SpriteID key, out RefCountedSprite value)
    {
        LinkedListNode <KeyValuePair <SpriteID, RefCountedSprite> > node;

        bool result = false;

        lock (_dict)
            result = _dict.TryGetValue(key, out node);

        if (node != null)
        {
            value = node.Value.Value;
            _list.Remove(node);
            _list.AddFirst(node);
        }
        else
        {
            value = default(RefCountedSprite);
        }

        return(result);
    }
 public RefCountedSprite this[SpriteID key]
 {
     get
     {
         RefCountedSprite value;
         if (TryGetValue(key, out value))
         {
             return(value);
         }
         return(default(RefCountedSprite));
     }
     set
     {
         if (Equals(value, default(RefCountedSprite)))
         {
             Remove(key);
         }
         else
         {
             Add(key, value);
         }
     }
 }
Exemple #28
0
 public GameObject(SpriteID spriteId, Vector2 pos, double scale)
 {
     this._spriteId = spriteId;
     this._pos = pos;
     this._scale = scale;
 }
Exemple #29
0
 public void Awake()
 {
     spriteIdInstance = this;
 }
 public ControllableObject(SpriteID spriteId, PlayerIndex owner)
     : base(spriteId)
 {
     this._owner = owner;
 }
Exemple #31
0
 public Inferno(SpriteID spriteId, Vector2 pos, double scale)
     : base(spriteId, pos, scale)
 {
 }
Exemple #32
0
 public ButtonProperties(SpriteID image, List <SpriteID> secondaryImages, string ButtonText, AnswerID ID, Action <int, int, bool, List <SequenceOfClick> > OnClickAction, bool isCorrect, List <SequenceOfClick> SequenceInfo)
     : this(image, secondaryImages, ButtonText, ID, OnClickAction, isCorrect, SequenceInfo, Color.black)
 {
 }
Exemple #33
0
 public Trap(ContentManager _content, SpriteID _spriteId)
     : base(_content, ID.CARD, _spriteId, eCardType.TRAP)
 {
     this.Original = new TrapCardData((TrapCardData)CardProvider.GetInstance().GetCardById(_spriteId.ToString()));
 }
Exemple #34
0
 public Sprite(SpriteID id, String name, String textureFileName)
     : this(id, name, textureFileName, new Vector2(0, 0), 0)
 {
 }
 public SynchroMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.SYNCHRO)
 {
 }
Exemple #36
0
 public Fireball(SpriteID spriteId, Vector2 pos, double scale, int speed)
     : base(spriteId, pos, scale)
 {
     this._speed = speed;
 }
Exemple #37
0
 public Backdrop(SpriteID spriteId, Vector2 pos, double scale)
     : base(spriteId, pos, scale)
 {
 }
 public bool ContainsKey(SpriteID key)
 {
     lock (_dict)
         return(_dict.ContainsKey(key));
 }
 public XYZMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.XYZ)
 {
     meterial = new List<Monster>(5);
 }
Exemple #40
0
 public Spell(ContentManager _content, SpriteID _spriteId)
     : base(_content, ID.CARD, _spriteId, eCardType.SPELL)
 {
     this.Original = new SpellCardData((SpellCardData)CardProvider.GetInstance().GetCardById(_spriteId.ToString()));
 }
 public XYZMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.XYZ)
 {
     meterial = new List <Monster>(5);
 }
Exemple #42
0
 public GameObject(SpriteID spriteId)
     : this(spriteId, new Vector2(0, 0), 1.0f)
 {
 }
Exemple #43
0
 public Spell(ContentManager _content, SpriteID _spriteId)
     : base(_content, ID.CARD, _spriteId, eCardType.SPELL)
 {
     this.Original = new SpellCardData((SpellCardData)CardProvider.GetInstance().GetCardById(_spriteId.ToString()));
 }
Exemple #44
0
 public Sprite(SpriteID id)
 {
     this.ID = id;
 }
Exemple #45
0
 public Particle(SpriteID spriteId, Vector2 pos, double scale, int speed, double direction, double timeOut, Boolean fade)
     : this(spriteId, pos, scale, speed, direction, timeOut)
 {
     this._fade = fade;
 }
Exemple #46
0
 public FusionMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.FUSION)
 {
 }
 public SynchroMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.SYNCHRO)
 {
 }
 public ControllableObject(SpriteID spriteId, Vector2 pos, double scale, PlayerIndex owner)
     : base(spriteId, pos, scale)
 {
     this._owner = owner;
 }
Exemple #49
0
 public SpeedTouchAnswerInfo(SpriteID SpriteID, bool IsCorrect, AnswerID AnswerID)
 {
     this.SpriteID  = SpriteID;
     this.IsCorrect = IsCorrect;
     this.AnswerID  = AnswerID;
 }
 public FusionMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.FUSION)
 {
 }
Exemple #51
0
    private ColorEnum GetColorBasedOnAnswerOrSpriteID(IDType iD, AnswerID answerID = AnswerID.None, SpriteID spriteID = SpriteID.DummySprite)
    {
        switch (iD)
        {
        case IDType.AnswerID:

            switch (answerID)     //AnswerID
            {
            case AnswerID.Balloon_Blue:
                return(ColorEnum.Blue);

            case AnswerID.Balloon_Red:
                return(ColorEnum.Red);

            case AnswerID.Balloon_Green:
                return(ColorEnum.Green);

            default:
                return(ColorEnum.Yellow);
            }

        default:     //SpriteID

            switch (spriteID)
            {
            case SpriteID.Balloon_Blue:
                return(ColorEnum.Blue);

            case SpriteID.Balloon_Red:
                return(ColorEnum.Red);

            case SpriteID.Balloon_Green:
                return(ColorEnum.Green);

            default:
                return(ColorEnum.Yellow);
            }
        }
    }
Exemple #52
0
 public Dragon(SpriteID spriteId, Vector2 pos, double scale)
     : base(spriteId, pos, scale)
 {
 }
Exemple #53
0
 public Trap(ContentManager _content, SpriteID _spriteId)
     : base(_content, ID.CARD, _spriteId, eCardType.TRAP)
 {
     this.Original = new TrapCardData((TrapCardData)CardProvider.GetInstance().GetCardById(_spriteId.ToString()));
 }