Exemplo n.º 1
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginPosition"))
     {
         BeginPosition = JTweenUtils.JsonToVector3(json["beginPosition"]);
     }
     // end if
     if (json.Contains("move"))
     {
         m_MoveType   = MoveTypeEnum.Move;
         m_toPosition = JTweenUtils.JsonToVector3(json["move"]);
     }
     else if (json.Contains("moveX"))
     {
         m_MoveType = MoveTypeEnum.MoveX;
         m_toMoveX  = (float)json["moveX"];
     }
     else if (json.Contains("moveY"))
     {
         m_MoveType = MoveTypeEnum.MoveY;
         m_toMoveY  = (float)json["moveY"];
     }
     else if (json.Contains("moveZ"))
     {
         m_MoveType = MoveTypeEnum.MoveZ;
         m_toMoveZ  = (float)json["moveZ"];
     }
     else
     {
         Debug.LogError(GetType().FullName + " JsonTo MoveType is null");
     } // end if
     Restore();
 }
Exemplo n.º 2
0
 public MoveViewModel(string name, MoveTypeEnum moveType, ObservableCollection<HitViewModel> hits, CommandViewModel command)
 {
     Name = name;
     MoveType = moveType;
     Hits = hits;
     Command = command;
 }
 protected override void JsonTo(IJsonNode json)
 {
     if (json.Contains("beginPosition"))
     {
         BeginPosition = JTweenUtils.JsonToVector3(json.GetNode("beginPosition"));
     }
     // end if
     if (json.Contains("move"))
     {
         m_MoveType   = MoveTypeEnum.Move;
         m_toPosition = JTweenUtils.JsonToVector3(json.GetNode("move"));
     }
     else if (json.Contains("moveX"))
     {
         m_MoveType = MoveTypeEnum.MoveX;
         m_toMoveX  = json.GetFloat("moveX");
     }
     else if (json.Contains("moveY"))
     {
         m_MoveType = MoveTypeEnum.MoveY;
         m_toMoveY  = json.GetFloat("moveY");
     }
     else if (json.Contains("moveZ"))
     {
         m_MoveType = MoveTypeEnum.MoveZ;
         m_toMoveZ  = json.GetFloat("moveZ");
     }
     else
     {
         Debug.LogError(GetType().FullName + " JsonTo MoveType is null");
     } // end if
     Restore();
 }
Exemplo n.º 4
0
 public MoveViewModel(IEventAggregator events, string name, MoveTypeEnum moveType, ObservableCollection <HitViewModel> hits, CommandViewModel command)
 {
     _events  = events;
     Name     = name;
     MoveType = moveType;
     Hits     = hits;
     Command  = command;
 }
Exemplo n.º 5
0
 public MoveViewModel(IEventAggregator events, string name, MoveTypeEnum moveType, ObservableCollection<HitViewModel> hits, CommandViewModel command)
 {
     _events = events;
     Name = name;
     MoveType = moveType;
     Hits = hits;
     Command = command;
 }
Exemplo n.º 6
0
        /// <summary>
        /// 解析処理
        /// </summary>
        /// <param name="data">解析対象バイト配列</param>
        /// <param name="startIndex">解析開始インデックス</param>
        /// <returns>解析済みインデックス</returns>
        public override int Analyze(byte[] data, int startIndex)
        {
            int retVal = 0;
            int index  = startIndex;

            int value = BitConverter.ToInt32(data, index);

            this.MoveType = (MoveTypeEnum)value;
            index        += sizeof(int);

            retVal = index;

            return(retVal);
        }
Exemplo n.º 7
0
 private void MoveUIElement(UIElement uie, System.Windows.Point p, MoveTypeEnum mtype)
 {
     if (!IsLocationEqual(uie, p, mtype))
     {
         if (uie.Visibility == Visibility.Visible)
         {
             uie.Visibility = Visibility.Hidden;
             MoveUIElementInner(uie, p, mtype);
             uie.Visibility = Visibility.Visible;
         }
         else
         {
             MoveUIElementInner(uie, p, mtype);
         }
     }
 }
Exemplo n.º 8
0
 private void MoveUIElementInner(UIElement uie, System.Windows.Point p, MoveTypeEnum mtype)
 {
     if (mtype != MoveTypeEnum.LeftTop)
     {
         if (mtype != MoveTypeEnum.RightTop)
         {
             Util.Assert(false);
         }
         else
         {
             Canvas.SetRight(uie, p.X);
             Canvas.SetTop(uie, p.Y);
         }
     }
     else
     {
         Canvas.SetLeft(uie, p.X);
         Canvas.SetTop(uie, p.Y);
     }
 }
Exemplo n.º 9
0
        private bool IsLocationEqual(UIElement uie, System.Windows.Point p, MoveTypeEnum mtype)
        {
            bool rt;

            if (mtype != MoveTypeEnum.LeftTop)
            {
                if (mtype != MoveTypeEnum.RightTop)
                {
                    Util.Assert(false);
                    rt = false;
                }
                else
                {
                    rt = (Canvas.GetRight(uie) == p.X && Canvas.GetTop(uie) == p.Y);
                }
            }
            else
            {
                rt = (Canvas.GetLeft(uie) == p.X && Canvas.GetTop(uie) == p.Y);
            }
            return(rt);
        }
Exemplo n.º 10
0
        public static MoveType GetType(MoveTypeEnum type)
        {
            MoveType mType = null;

            switch (type)
            {
            case MoveTypeEnum.Unit:
                mType = new UnitMoveType();
                break;

            case MoveTypeEnum.Vehicle:
                mType = new VehicleMoveType();
                break;

            case MoveTypeEnum.Ship:
                // TODO ...
                break;

            case MoveTypeEnum.ShipRequest:
                // TODO ...
                break;

            case MoveTypeEnum.Transfer:
                // TODO ...
                break;

            default:
                mType = new DefaultMoveType();
                break;
            }

            if (mType != null)
            {
                mType.Type = type;
            }
            return(mType);
        }
Exemplo n.º 11
0
        public Army()
        {
            _id = 0;
            _name = "";
            _playerId = 0;
            _heroId = 0;
            _monsterId = 0;
            _moveType = MoveTypeEnum.Ground;

            _basicHealth = 0;
            _health = 0;
            _healthRemain = 0;

            _basicSpeed = 0;
            _speed = 0;

            _qty = 0;
            _qtyLeft = 0;
            _slotNo = 0;

            _isBig = false;

            _slotImgFileName = "";
        }
Exemplo n.º 12
0
 private void btnMoveLeft_MouseDown(object sender, MouseEventArgs e)
 {
     MoveType = MoveTypeEnum.MoveLeft;
     MoveStep();
 }
Exemplo n.º 13
0
        public void CopyFrom(Heroes.Core.Army army)
        {
            this._id = army._id;
            this._name = army._name;
            this._playerId = army._playerId;
            this._heroId = army._heroId;
            this._monsterId = army._monsterId;

            this._gold = army._gold;

            this._slotNo = army._slotNo;
            this._qty = army._qty;
            this._qtyLeft = army._qtyLeft;
            this._basicAttack = army._basicAttack;
            this._basicDefense = army._basicDefense;
            this._attack = army._attack;
            this._defense = army._defense;
            this._minDamage = army._minDamage;
            this._maxDamage = army._maxDamage;
            this._noOfShot = army._noOfShot;
            this._shotRemain = army._shotRemain;
            this._hasUnlimitedAmmo = army._hasUnlimitedAmmo;
            this._hasRangeAttack = army._hasRangeAttack;
            this._moveType = army._moveType;
            this._handToHandPenalty = army._handToHandPenalty;

            this._basicSpeed = army._basicSpeed;
            this._speed = army._speed;

            this._basicHealth = army._basicHealth;
            this._health = army._health;
            this._healthRemain = army._healthRemain;

            this._noOfRetaliate = army._noOfRetaliate;
            this._retaliateRemain = army._retaliateRemain;
            this._hasUnlimitedRetaliate = army._hasUnlimitedRetaliate;
            this._noOfAttack = army._noOfAttack;
            this._experience = army._experience;

            this._isBig = army._isBig;

            this._slotImgFileName = army._slotImgFileName;
        }
        /// <summary>
        /// 移動タイプを決定する
        /// </summary>
        public virtual void SetMoveType()
        {
            if (beforePosition == null)
            {
                this.beforePosition = new SSPosition(this.position.PosX, this.position.PosY);
                return;
            }

            if (this.position.PosX == this.beforePosition.PosX && this.beforePosition.PosY == this.position.PosY)
            {
                this.MoveType = MoveTypeEnum.Center;
                return;
            }

            if (this.position.PosX == this.beforePosition.PosX)
            {
                if (this.position.PosY > this.beforePosition.PosY)
                {
                    this.MoveType = MoveTypeEnum.Down;
                }
                else
                {
                    this.MoveType = MoveTypeEnum.Up;
                }
                return;
            }

            if (this.position.PosX > this.beforePosition.PosX)
            {
                if (this.beforePosition.PosY == this.position.PosY)
                {
                    this.MoveType = MoveTypeEnum.Right;
                    return;
                }

                if (this.beforePosition.PosY > this.position.PosY)
                {
                    this.MoveType = MoveTypeEnum.RightUp;
                    return;
                }

                if (this.beforePosition.PosY < this.position.PosY)
                {
                    this.MoveType = MoveTypeEnum.RightDown;
                    return;
                }
            }

            if (this.position.PosX < this.beforePosition.PosX)
            {
                if (this.beforePosition.PosY == this.position.PosY)
                {
                    this.MoveType = MoveTypeEnum.Left;
                    return;
                }

                if (this.beforePosition.PosY > this.position.PosY)
                {
                    this.MoveType = MoveTypeEnum.LeftUp;
                    return;
                }

                if (this.beforePosition.PosY < this.position.PosY)
                {
                    this.MoveType = MoveTypeEnum.LeftDown;
                    return;
                }
            }
        }