示例#1
0
        public static bool NewFactory(PaxIntent p_intent, out PaxState p_state)
        {
            PaxState parent0 = null;

            if (!PaxState._root.TryFindChildState(p_intent, out parent0))
            {
                p_state = null;
                return(false);
            }

            String name = null;
            String type = p_intent._argv["p_type"];

            switch (type)
            {
            case "Pax4Object":
                name    = p_intent._argv["p_name"];
                p_state = new Pax4Object(name, parent0);
                return(true);

            case "Pax4Sprite":
                name    = p_intent._argv["p_name"];
                p_state = new Pax4Sprite(name, parent0);
                return(true);

            case "Pax4Slider":
                name    = p_intent._argv["p_name"];
                p_state = new Pax4Slider(name, parent0);
                return(true);

            default:
                return(PaxState.NewFactory(p_intent, out p_state));
            }
        }
示例#2
0
        public Pax4WorldLavaAndIce(String p_name, PaxState p_parent0)
            : base(p_name, p_parent0)
        {
            if (Pax4ActorPlayerAmmoLava._current != null)
            {
                Pax4ActorPlayerAmmoLava._current.Dx();
            }
            Pax4ActorPlayerAmmoLava._current = null;

            if (Pax4ActorPlayerAmmoIce._current != null)
            {
                Pax4ActorPlayerAmmoIce._current.Dx();
            }
            Pax4ActorPlayerAmmoIce._current = null;

            if (Pax4ActorEnemyMonsterLava._current != null)
            {
                Pax4ActorEnemyMonsterLava._current.Dx();
            }
            Pax4ActorEnemyMonsterLava._current = null;

            if (Pax4ActorEnemyMonsterIce._current != null)
            {
                Pax4ActorEnemyMonsterIce._current.Dx();
            }
            Pax4ActorEnemyMonsterIce._current = null;

            Pax4ActorEnemyAmmoLava._current.Clear();
            Pax4ActorEnemyAmmoIce._current.Clear();
        }
示例#3
0
 public Pax4Slider(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
     _positionModifier = new Pax4SpritePositionModifier("_positionModifier", null);
     _positionModifier.AddChild(this);
     _positionModifier.Ini(0.1f, 0.0f);
 }
示例#4
0
 public Pax4Sprite(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
     if (p_parent0 != null && p_parent0 is Pax4Sprite)
     {
         _centerPosition         = ((Pax4Sprite)p_parent0)._centerPosition + _centerPosition0;
         _rightViewingThreshold  = ((Pax4Sprite)p_parent0)._rightViewingThreshold;
         _bottomViewingThreshold = ((Pax4Sprite)p_parent0)._bottomViewingThreshold;
         _topViewingThreshold    = ((Pax4Sprite)p_parent0)._topViewingThreshold;
         _leftViewingThreshold   = ((Pax4Sprite)p_parent0)._leftViewingThreshold;
     }
     else
     {
         if (Pax4Game._graphicsDeviceManager != null)
         {
             _rightViewingThreshold  = Pax4Game._graphicsDeviceManager.PreferredBackBufferWidth;
             _bottomViewingThreshold = Pax4Game._graphicsDeviceManager.PreferredBackBufferHeight;
         }
         else
         {
             _rightViewingThreshold  = 0;
             _bottomViewingThreshold = 0;
         }
         _topViewingThreshold  = 0;
         _leftViewingThreshold = 0;
     }
 }
示例#5
0
        //private bool _dx = true;
        #endregion

        public Pax4Sound(String p_name, PaxState p_parent0) :
            base(p_name, p_parent0)
        {
            _current = this;

            MediaPlayer.IsRepeating = false;
            MediaPlayer.Volume      = 0.50f;
        }
示例#6
0
 public Pax4UiState(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
     if (p_parent0 == null)
     {
         SetParent0(Pax4Ui._current);
     }
 }
示例#7
0
        public Pax4TouchState(String p_name, PaxState p_parent0)
            : base(p_name, p_parent0)
        {
#if !WINDOWS_MOUSE
            _state = TouchPanel.GetState();
#else
            _state = Mouse.GetState();
#endif
        }
示例#8
0
        public override void AddChild(PaxState p_state, bool p_recursive = true)
        {
            if (_currentSprite == null)
            {
                _currentSprite = (Pax4Sprite)p_state;
            }

            base.AddChild(p_state, p_recursive);
        }
示例#9
0
        public virtual void RegisterIntent()
        {
            //PaxState.RegisterIntent();

            PaxState.RegisterIntent <Pax4Object>();
            PaxState.RegisterIntent <Pax4Sprite>();

            PaxState._newFactoryDelegate          = NewFactory;
            PaxState._covertPropertyValueDelegate = ConvertPropertyValue;
        }
示例#10
0
        public Pax4Touch(String p_name, PaxState p_parent0)
            : base(p_name, p_parent0)
        {
#if !WINDOWS_MOUSE
            _touchPanelCapabilities = TouchPanel.GetCapabilities();
#endif
            Reset();

            _flickVelocityThreshold *= Pax4Camera._current._scale2.X;

            _current = this;
        }
示例#11
0
文件: Pax4Ui.cs 项目: pax7/LavaAndIce
        public void Enter(String p_uiState = null)
        {
            if (p_uiState == null)
            {
                return;
            }

            PaxState uiState = null;

            if (TryGetChild(p_uiState, out uiState))
            {
                Enter((Pax4UiState)uiState);
            }
        }
示例#12
0
        //[Intent(_type, "AddChild", typeof(Pax4Sprite), "p_child")]
        public override void AddChild(PaxState p_state, bool p_recursive = true)
        {
            if (p_state != null)
            {
                base.AddChild(p_state, p_recursive);

                if (!(p_state is Pax4Sprite))
                {
                    return;
                }

                Pax4Sprite state = (Pax4Sprite)p_state;

                if (_childSprite == null)
                {
                    _childSprite = new List <Pax4Sprite>();
                }

                _childSprite.Add(state);

                if (_childSprite.Count == 1)
                {
                    _currentSnapSprite = state;
                }

                if (_verticalScroll)
                {
                    state.SetPosition(new Vector2(0.0f, _nextPosition + state._originRelativeScaledDraw.Y));
                    _nextPosition += .15f;
                    this.SetRectangleWidthHeight(_rectangle0.Width, _rectangle0.Height + state._rectangle0.Height);
                    //p_child.SetViewingThreshold(_leftViewingThreshold, _rightViewingThreshold,_topViewingThreshold,_bottomViewingThreshold);

                    _dnextPosition = Math.Abs(_nextPosition - _nextPosition0);
                }
                else
                {
                    state.SetPosition(new Vector2(_nextPosition + state._originRelativeScaledDraw.X, 0.0f));
                    _nextPosition += .65f;
                    this.SetRectangleWidthHeight((int)(_rectangle0.Width + state._rectangle0.Width), _rectangle0.Height);
                    // p_child.SetViewingThreshold(_leftViewingThreshold, _rightViewingThreshold, _topViewingThreshold, _bottomViewingThreshold);
                    _dnextPosition = Math.Abs(_nextPosition - _nextPosition0);
                }


                p_state._parent0 = this;
            }

            _nextPosition0 = _nextPosition;
        }
示例#13
0
        public override void AddChild(PaxState p_state, bool p_recursive = true)
        {
            if (p_state is Pax4Sprite)
            {
                Pax4Sprite sprite = (Pax4Sprite)p_state;

                if (sprite == null)
                {
                    return;
                }
                if (_sprite == null)
                {
                    _sprite = new List <Pax4Sprite>();
                }

                _sprite.Add(sprite);
            }
            base.AddChild(p_state, p_recursive);
        }
示例#14
0
        //public Pax4ModifierCamera _cameraPositionModifier = null;
        //public Pax4ModifierCamera _cameraTargetModifier = null;
        //public Pax4ModifierCamera _cameraShakeModifier = null;

        public Pax4Camera(String p_name, PaxState p_parent0)
            : base(p_name, p_parent0)
        {
            _current = this;

            _backBufferWidth  = Pax4Game._graphicsDeviceManager.PreferredBackBufferWidth;
            _backBufferHeight = Pax4Game._graphicsDeviceManager.PreferredBackBufferHeight;

            //if (_backBufferWidth > _backBufferHeight)
            //{
            _aspectRatio    = (float)_backBufferWidth / (float)_backBufferHeight;
            _isInViewFactor = 2.0f * (float)Math.Tan(_aspectRatio / 2.0f);


            //    _scale.Z = _aspectRatio / 1.77778f;

            //    _scale.X = _scale0.X / (float)_backBufferWidth;
            //    _scale.Y = _scale0.Y / (float)_backBufferHeight;
            //}
            //else
            //{
            //    _aspectRatio = (float)_backBufferHeight / (float)_backBufferWidth;
            //    _scale.Z = 1 / _aspectRatio / 1.77778f;

            //    _scale.X = _scale0.X / (float)_backBufferHeight;
            //    _scale.Y = _scale0.Y / (float)_backBufferWidth;
            //}

            //_scale2.X = _scale.X;
            //_scale2.Y = _scale.Y;

            //_matScale = Matrix.CreateScale(_scale2.X, _scale2.X, 1.0f);

            //_cameraShakeModifier = new Pax4CameraTargetModifier();
            //_cameraShakeModifier.Ini(0.016f);

            //_cameraPositionModifier = new Pax4CameraPositionModifier();
            //_cameraTargetModifier = new Pax4CameraPositionModifier();

            Pax4Game._graphicsDeviceManager.ApplyChanges();
        }
示例#15
0
        //private bool _dx = true;

        public Pax4SpriteFont(String p_name, PaxState p_parent0)
            : base(p_name, p_parent0)
        {
            _current = this;
        }
示例#16
0
 public Pax4SpriteRotationModifier(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#17
0
 public Pax4CameraPositionModifier(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#18
0
 public Pax4CameraTargetModifier(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#19
0
 public Pax4ModifierCamera(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
     _hasTarget0 = Pax4Camera._current._hasTarget;
 }
示例#20
0
 public Pax4ModifierWayPointPathScale(String p_name, PaxState p_parent0, Pax4WayPointPath p_wayPointPath = null)
     : base(p_name, p_parent0, p_wayPointPath)
 {
 }
示例#21
0
 public Pax4SpriteColorModifier(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#22
0
文件: Pax4Ui.cs 项目: pax7/LavaAndIce
 public Pax4Ui(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
     _current = this;
 }
示例#23
0
 public Pax4ModifierWayPointPath(String p_name, PaxState p_parent0, Pax4WayPointPath p_wayPointPath = null)
     : base(p_name, p_parent0)
 {
     AddPath(p_wayPointPath);
 }
示例#24
0
        //public Pax4ModifierSprite(String p_name, Pax4Object p_parent0)
        //    : base(p_name, p_parent0)
        //{
        //    AddSprite(p_sprite);
        //    _currentSprite = p_sprite;
        //}

        public Pax4ModifierSprite(String p_name, PaxState p_parent0)
            : base(p_name, p_parent0)
        {
        }
示例#25
0
 public Pax4EffectState(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#26
0
 public Pax4Object(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#27
0
 public Pax4SpriteTextNumberModifier(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#28
0
 public Pax4ModelState(String p_name, PaxState p_parent0)
     : base(p_name, p_parent0)
 {
 }
示例#29
0
        public Pax4SoundLavaAndIce(String p_name, PaxState p_parent0)
            : base(p_name, p_parent0)
        {
            MediaPlayer.Volume = 0f; //!*
            _current           = this;

            List <String> list = new List <String>();

            //******************
            //sound*************
            //******************
            list.Add("Sound/lavaandiceMenu1");
            list.Add("Sound/lavaandiceMenu2");
            list.Add("Sound/lavaandiceMission1");
            list.Add("Sound/lavaandiceMission2");
            LoadSong(list);
            list.Clear();

            list.Add("Sound/lavaandiceGameOver");
            list.Add("Sound/lavaandiceWinParade");
            LoadStateSong(list);
            list.Clear();

            list.Add("Sound/lavaandiceButtonAccepted");
            list.Add("Sound/lavaandiceButtonDenied");

            list.Add("Sound/lavaandiceBurning");
            list.Add("Sound/lavaandiceBurning1");
            list.Add("Sound/lavaandiceFreezing");
            list.Add("Sound/lavaandiceFreezing1");

            list.Add("Sound/lavaandiceLavaLaunch");
            list.Add("Sound/lavaandiceLavaLaunch1");
            list.Add("Sound/lavaandiceIceLaunch");
            list.Add("Sound/lavaandiceIceLaunch1");

            list.Add("Sound/lavaandiceLavaExplosion");
            list.Add("Sound/lavaandiceLavaExplosion1");
            list.Add("Sound/lavaandiceIceExplosion");
            list.Add("Sound/lavaandiceIceExplosion1");

            list.Add("Sound/lavaandiceTrumpet");

            list.Add("Sound/lavaandiceTimer1");
            list.Add("Sound/lavaandiceTimer2");
            LoadSoundEffect(list);
            list.Clear();

            //******************
            //soundeffect*************
            //******************

            _lavaandiceButtonAccepted = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceButtonAccepted");
            _lavaandiceButtonDenied   = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceButtonDenied");

            _lavaandiceBurning   = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceBurning");
            _lavaandiceBurning1  = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceBurning1");
            _lavaandiceFreezing  = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceFreezing");
            _lavaandiceFreezing1 = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceFreezing1");

            _lavaandiceLavaLaunch  = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceLavaLaunch");
            _lavaandiceLavaLaunch1 = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceLavaLaunch1");
            _lavaandiceIceLaunch   = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceIceLaunch");
            _lavaandiceIceLaunch1  = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceIceLaunch1");

            _lavaandiceLavaExplosion  = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceLavaExplosion");
            _lavaandiceLavaExplosion1 = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceLavaExplosion1");
            _lavaandiceIceExplosion   = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceIceExplosion");
            _lavaandiceIceExplosion1  = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceIceExplosion1");

            _lavaandiceTrumpet = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceTrumpet");

            _lavaandiceTimer1 = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceTimer1");
            _lavaandiceTimer2 = Pax4Sound._current.GetSoundEffect("Sound/lavaandiceTimer2");
        }
示例#30
0
        public static bool ConvertPropertyValue(PaxState p_state, FieldInfo p_fieldInfo, String p_result)
        {
            if (p_state == null || p_result == null)
            {
                return(false);
            }

            try
            {
                String propertyInfo = p_fieldInfo.FieldType.ToString();
                switch (propertyInfo)
                {
                case "Microsoft.Xna.Framework.Vector2":
                    Vector2 v2Result;
                    if (PaxTools.Deserialize <Vector2>(p_result, out v2Result))
                    {
                        p_fieldInfo.SetValue(p_state, v2Result);
                    }
                    return(true);

                case "Microsoft.Xna.Framework.Rectangle":
                    Rectangle rectResult;
                    if (PaxTools.Deserialize <Rectangle>(p_result, out rectResult))
                    {
                        p_fieldInfo.SetValue(p_state, rectResult);
                    }
                    return(true);

                case "Microsoft.Xna.Framework.Vector3":
                    Vector3 v3Result;
                    if (PaxTools.Deserialize <Vector3>(p_result, out v3Result))
                    {
                        p_fieldInfo.SetValue(p_state, v3Result);
                    }
                    return(true);

                case "Microsoft.Xna.Framework.Vector4":
                    Vector4 v4Result;
                    if (PaxTools.Deserialize <Vector4>(p_result, out v4Result))
                    {
                        p_fieldInfo.SetValue(p_state, v4Result);
                    }
                    return(true);

                case "Microsoft.Xna.Framework.Matrix":
                    Matrix matResult;
                    if (PaxTools.Deserialize <Matrix>(p_result, out matResult))
                    {
                        p_fieldInfo.SetValue(p_state, matResult);
                    }
                    return(true);

                case "Microsoft.Xna.Framework.Quaternion":
                    Quaternion quatResult;
                    if (PaxTools.Deserialize <Quaternion>(p_result, out quatResult))
                    {
                        p_fieldInfo.SetValue(p_state, quatResult);
                    }
                    return(true);

                case "Microsoft.Xna.Framework.Color":
                    Color cResult;
                    if (PaxTools.Deserialize <Color>(p_result, out cResult))
                    {
                        p_fieldInfo.SetValue(p_state, cResult);
                    }
                    return(true);

                default:
                    return(PaxState.ConvertPropertyValue(p_state, p_fieldInfo, p_result));
                }
            }
            catch (Exception ex)
            {
#if WINDOWS
                Console.WriteLine(ex.ToString());
#endif
            }
            return(false);
        }