예제 #1
0
        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());
        }
예제 #2
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();
 }
예제 #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;
 }
예제 #4
0
    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);
                }
            }
        }
    }
예제 #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();
 }
예제 #6
0
        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();
        }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #11
0
 /// <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");
     }
 }
예제 #12
0
 /// <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");
     }
 }
예제 #13
0
 public Texture2D GetTexture(SpriteID _id)
 {
     try
     {
         return _listSprite[(int)_id].Texture;
     }
     catch
     {
         throw new Exception("Id: \'" + _id + "\' is not exists");
     }
 }
예제 #14
0
    public Sprite GetSpriteFromID(SpriteID ID)
    {
        Sprite sprite = GetSprite(ID);

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

        return(sprite);
    }
예제 #15
0
 public static Sprite Get(SpriteID id)
 {
     foreach (Sprite g in graphics)
     {
         if (g.id.Equals(id))
         {
             return g;
         }
     }
     return null;
 }
예제 #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;
 }
예제 #17
0
 public Texture2D GetTexture(SpriteID _id)
 {
     try
     {
         return(_listSprite[(int)_id].Texture);
     }
     catch
     {
         throw new Exception("Id: \'" + _id + "\' is not exists");
     }
 }
예제 #18
0
    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);
    }
예제 #19
0
 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()));
     }
 }
예제 #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);
        }
    }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #24
0
    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);
            }
        }
    }
예제 #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);
        }
예제 #26
0
    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);
    }
예제 #27
0
 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);
         }
     }
 }
예제 #28
0
 public GameObject(SpriteID spriteId, Vector2 pos, double scale)
 {
     this._spriteId = spriteId;
     this._pos = pos;
     this._scale = scale;
 }
예제 #29
0
 public void Awake()
 {
     spriteIdInstance = this;
 }
예제 #30
0
 public ControllableObject(SpriteID spriteId, PlayerIndex owner)
     : base(spriteId)
 {
     this._owner = owner;
 }
예제 #31
0
 public Inferno(SpriteID spriteId, Vector2 pos, double scale)
     : base(spriteId, pos, scale)
 {
 }
예제 #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)
 {
 }
예제 #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()));
 }
예제 #34
0
 public Sprite(SpriteID id, String name, String textureFileName)
     : this(id, name, textureFileName, new Vector2(0, 0), 0)
 {
 }
예제 #35
0
 public SynchroMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.SYNCHRO)
 {
 }
예제 #36
0
 public Fireball(SpriteID spriteId, Vector2 pos, double scale, int speed)
     : base(spriteId, pos, scale)
 {
     this._speed = speed;
 }
예제 #37
0
 public Backdrop(SpriteID spriteId, Vector2 pos, double scale)
     : base(spriteId, pos, scale)
 {
 }
예제 #38
0
 public bool ContainsKey(SpriteID key)
 {
     lock (_dict)
         return(_dict.ContainsKey(key));
 }
예제 #39
0
 public XYZMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.XYZ)
 {
     meterial = new List<Monster>(5);
 }
예제 #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()));
 }
예제 #41
0
 public XYZMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.XYZ)
 {
     meterial = new List <Monster>(5);
 }
예제 #42
0
 public GameObject(SpriteID spriteId)
     : this(spriteId, new Vector2(0, 0), 1.0f)
 {
 }
예제 #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()));
 }
예제 #44
0
 public Sprite(SpriteID id)
 {
     this.ID = id;
 }
예제 #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;
 }
예제 #46
0
 public FusionMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.FUSION)
 {
 }
예제 #47
0
 public SynchroMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.SYNCHRO)
 {
 }
예제 #48
0
 public ControllableObject(SpriteID spriteId, Vector2 pos, double scale, PlayerIndex owner)
     : base(spriteId, pos, scale)
 {
     this._owner = owner;
 }
예제 #49
0
 public SpeedTouchAnswerInfo(SpriteID SpriteID, bool IsCorrect, AnswerID AnswerID)
 {
     this.SpriteID  = SpriteID;
     this.IsCorrect = IsCorrect;
     this.AnswerID  = AnswerID;
 }
예제 #50
0
 public FusionMonster(ContentManager _content, SpriteID _spriteId)
     : base(_content, _spriteId, eCardType.FUSION)
 {
 }
예제 #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);
            }
        }
    }
예제 #52
0
 public Dragon(SpriteID spriteId, Vector2 pos, double scale)
     : base(spriteId, pos, scale)
 {
 }
예제 #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()));
 }