Esempio n. 1
0
        protected override void Start()
        {
            base.Start();
            Skill.Framework.Audio.PitchListener listener = GetComponent <Skill.Framework.Audio.PitchListener>();
            if (listener != null)
            {
                listener.RelinkAudios();
            }

            _InTransition = false;
            _NextState    = null;
            _ScheduleNextStateTW.End();
            if (_CurrentState != null)
            {
                if (_CurrentState.Clip != null)
                {
                    _CurrentState.Initialize(false);
                    _CurrentState.StartTime(1, 0);
                }

                if (_CurrentState.NextState != null)
                {
                    float deltaTime = _CurrentState.End - _CurrentState.Begin + 1;
                    if (deltaTime > BufferTime)
                    {
                        _ScheduleNextStateTW.Begin(deltaTime);
                    }
                    else
                    {
                        ScheduleNextState(deltaTime);
                    }
                }
            }
        }
Esempio n. 2
0
        public IList List(Type type, Command cmd, Region region)
        {
            TimeWatch.Start("Peanut->Execute SQL Return List");
            if (region == null)
            {
                region = new Region {
                    Start = 0, Size = 99999999
                }
            }
            ;
            IList items = null;

            if (Mappings.ObjectMapper.CurrentOM.SelectChange != null)
            {
                Mappings.ObjectMapper.CurrentOM.SelectChange.Change(cmd);
            }
            System.Type itemstype = System.Type.GetType("System.Collections.Generic.List`1");
            itemstype = itemstype.MakeGenericType(type);
            if (region.Size > DBContext.DefaultListMaxSize)
            {
                items = (IList)Activator.CreateInstance(itemstype, DBContext.DefaultListMaxSize);
            }
            else
            {
                items = (IList)Activator.CreateInstance(itemstype, region.Size);
            }
            object item = null;

            using (IDataReader reader = ExecuteReader(cmd))
            {
                int index = 0;
                while (reader.Read())
                {
                    if (index >= region.Start)
                    {
                        item = Activator.CreateInstance(type);

                        if (item is IEntityState)
                        {
                            ((IEntityState)item).ConnectionName = this.ConnectionName;
                            ((IEntityState)item).LoadData(reader);
                        }
                        else
                        {
                            Mappings.ObjectMapper.CurrentSelectReader.ReaderToObject(reader, item);
                        }
                        items.Add(item);
                        if (items.Count == region.Size)
                        {
                            cmd.DbCommand.Cancel();
                            reader.Close();
                            break;
                        }
                    }
                    index++;
                }
            }
            TimeWatch.End();
            return(items);
        }
Esempio n. 3
0
 /// <summary>
 /// Update
 /// </summary>
 protected override void Update()
 {
     if (CleanInterval > 0)
     {
         if (_CleanTW.IsEnabled)
         {
             if (_CleanTW.IsOver)
             {
                 foreach (var item in Caches)
                 {
                     if (item != null)
                     {
                         item.Clean();
                     }
                 }
                 _CleanTW.End();
             }
         }
         else
         {
             _CleanTW.Begin(CleanInterval);
         }
     }
     base.Update();
 }
Esempio n. 4
0
 /// <summary>
 /// Defines how to lock key and if success returns true, otherwise false.
 /// </summary>
 /// <returns>True for success, false for fail</returns>
 public override bool Lock()
 {
     if (!_Lock)
     {
         if (_TimeTW.IsEnabled)
         {
             if (_TimeTW.IsOver)
             {
                 _TimeTW.End();
                 _Lock = true;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             _Lock = true;
             return(true);
         }
     }
     return(false);
 }
Esempio n. 5
0
 protected override void Update()
 {
     if (_StartDelayTW.IsEnabled)
     {
         if (_StartDelayTW.IsOver)
         {
             _StartDelayTW.End();
         }
     }
     else if (!PlayerQuit)
     {
         if (UserPressedMenuButton())
         {
             if (IsVisible)
             {
                 if (TopDialog == null)
                 {
                     Back();
                 }
             }
             else
             {
                 PauseGame();
             }
         }
     }
     base.Update();
 }
Esempio n. 6
0
        public int ExecuteNonQuery(Command cmd)
        {
            TimeWatch.Start("Peanut->Execute NonQuery");
            int value = mHandler.ExecuteNonQuery(cmd);

            TimeWatch.End();
            return(value);
        }
Esempio n. 7
0
        public IDataReader ExecuteReader(Command cmd)
        {
            TimeWatch.Start("Peanut->Execute Reader");
            IDataReader result = mHandler.ExecuteReader(cmd);

            TimeWatch.End();
            return(result);
        }
Esempio n. 8
0
        public object ExecuteScalar(Command cmd)
        {
            TimeWatch.Start("Peanut->Execute Scalar");
            object result = mHandler.ExecuteScalar(cmd);

            TimeWatch.End();
            return(result);
        }
Esempio n. 9
0
        public object ExecProc(object parameter)
        {
            TimeWatch.Start("Peanut->Execute Proce Return Object");
            object result = mHandler.ExecProc(parameter);

            TimeWatch.End();
            return(result);
        }
Esempio n. 10
0
 /// <summary> Update </summary>
 protected override void Update()
 {
     if (_CurrentSplashIndex >= Images.Length) // all splash showed
     {
         if (!_IsCompleted)
         {
             _IsCompleted = true;
             OnCompleted();// raise Completed event
         }
     }
     else
     {
         if (_NextSplashTW.IsEnabled)
         {
             if (_NextSplashTW.IsOver) // fadeout is complete and times to change splash
             {
                 _NextSplashTW.End();
                 MoveNext();// show next and fadein
             }
         }
         else if (_SplashTW.IsEnabled)
         {
             if (_SplashTW.IsOver) // times to fadeout and prepare to show next splash
             {
                 _SplashTW.End();
                 ShowNext();
             }
             else if (_SplashTW.ElapsedTime > Images[_CurrentSplashIndex].MinDuration)
             {
                 if (Escape())// if user press escape button
                 {
                     if (FastEscape)
                     {
                         MoveNext();
                     }
                     else
                     {
                         ShowNext();
                     }
                 }
             }
         }
         _Frame.Update();
     }
     base.Update();
 }
Esempio n. 11
0
 /// <summary> Occurs when the selected item double clicked. </summary>
 protected virtual void OnSelectedDoubleClick()
 {
     _DoubleClickTW.End();
     if (SelectedDoubleClick != null)
     {
         SelectedDoubleClick(this, System.EventArgs.Empty);
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Update
 /// </summary>
 protected override void Update()
 {
     if (_LifeTimeTW.IsEnabledAndOver)
     {
         _LifeTimeTW.End();
         OnDie(null);
     }
     base.Update();
 }
Esempio n. 13
0
 void OnDisable()
 {
     if (_ActiveCurve != null)
     {
         _ActiveCurve = null;
         if (SceneLight)
         {
             SceneLight.intensity = _PreIntensity;
             SceneLight.color     = _PreLightColor;
             _SoundTW.End();
         }
     }
     if (_Audio.isPlaying)
     {
         _Audio.Stop();
     }
     _CurveTime = _MaxCurveTime;
 }
Esempio n. 14
0
        public void Play(Texture movie)
        {
#if SUPPORTMOVIE
            if (_Fading != null)
            {
                _Fading.Alpha = 1.0f;
            }

            if (_LastMovie != null)
            {
                _LastMovie.Stop();
                if (_Audio != null && _LastMovie.audioClip != null)
                {
                    _Audio.Stop();
                    _Audio.clip = null;
                }
            }
            if (movie != null && movie is MovieTexture)
            {
                MovieTexture movieTexture = (MovieTexture)movie;

                _LastMovie = movieTexture;
                movieTexture.Play();
                if (_Audio != null && movieTexture.audioClip != null)
                {
                    _Audio.clip = movieTexture.audioClip;
                    _Audio.Play();
                }
                if (_Fading != null)
                {
                    _Fading.FadeToZero(true);
                    _MovieTW.Begin(Mathf.Max(movieTexture.duration - _Fading.FadeOutTime, _Fading.FadeOutTime + 0.1f));
                }
                else
                {
                    _MovieTW.Begin(movieTexture.duration);
                }

                _EndTW.End();
                _ImgMovie.Texture     = movie;// change texture
                _SavedCutSceneEnable  = Global.CutSceneEnable;
                Global.CutSceneEnable = CutSceneEnable;
                if (SceneFading != null)
                {
                    SceneFading.FadeToOne();
                }
                OnBegin();
            }
            else
            {
                _ImgMovie.Texture = null;
            }
            enabled = true;
#endif
        }
Esempio n. 15
0
 /// <summary>
 /// Update
 /// </summary>
 protected override void Update()
 {
     if (_StartTW.IsEnabledAndOver)
     {
         if (this._Renderer != null)
         {
             this._Renderer.enabled = true;
         }
         _StartTW.End();
     }
     base.Update();
 }
Esempio n. 16
0
        private void EndMovie()
        {
            if (FastEscape)
            {
                _EndTW.Begin(0);
            }
            else if (_Fading != null)
            {
                _EndTW.Begin(_Fading.FadeOutTime + 0.1f);
            }
            else
            {
                _EndTW.Begin(0.1f);
            }

            if (_Fading != null)
            {
                _Fading.FadeToOne();
            }
            _MovieTW.End();
        }
Esempio n. 17
0
 public ConnectionContext(string connnectionString, IDriver driver, string connName)
 {
     TimeWatch.Start("Peanut->Create IConnection Context");
     mDB      = connName;
     mHandler = DBContext.CurrentHandler(connName);
     if (mHandler == null)
     {
         mHandler          = DBContext.AddConnectionHandler(connName, driver);
         mActiveConnection = true;
     }
     ConnectionName = connName;
     TimeWatch.End();
 }
Esempio n. 18
0
 /// <summary>
 /// Update
 /// </summary>
 protected override void Update()
 {
     if (_IsBreaking)
     {
         if (_BreakDelay.IsOver)
         {
             Break();
             _BreakDelay.End();
             _IsBreaking = false;
             enabled = false;
         }
     }
     else if (Matinee != null && Matinee.IsPlaying)
     {
         if (Matinee.PlaybackTime > StartDelay)
         {
             if (Input.GetKey(BreakKey))
             {
                 if (!_KeyHoldTW.IsEnabled)
                 {
                     _KeyHoldTW.Begin(KeyHoldTime);
                 }
                 else if (_KeyHoldTW.IsEnabledAndOver)
                 {
                     _KeyHoldTW.End();
                     BreakStart();
                     _BreakDelay.Begin(Delay);
                     _IsBreaking = true;
                 }
             }
             else
             {
                 _KeyHoldTW.End();
             }
         }
     }
     base.Update();
 }
Esempio n. 19
0
 /// <summary>
 /// Update
 /// </summary>
 protected override void Update()
 {
     if (Global.IsGamePaused)
     {
         return;
     }
     if (_DestroyTW.IsEnabledAndOver)
     {
         _DestroyTW.End();
         enabled = false;
         Cache.DestroyCache(gameObject);
     }
     base.Update();
 }
Esempio n. 20
0
        protected override void Update()
        {
            base.Update();
            if (Global.Instance != null)
            {
                _RainAudio.volume = (1.0f - _Fading.Alpha) * (Global.Instance.Settings.Audio.FxVolume * RainVolume);
            }
            else
            {
                _RainAudio.volume = (1.0f - _Fading.Alpha) * RainVolume;
            }

            if (_FadeTW.IsEnabled)
            {
                if (_FadeTW.IsOver)
                {
                    _FadeTW.End();
                    if (_Starting)
                    {
                        Particle.minEmission   = _MinEmission;
                        Particle.maxEmission   = _MaxEmission;
                        Specular.SpecularColor = RainSpecular;
                    }
                    if (_Stopping)
                    {
                        Particle.minEmission = 0;
                        Particle.maxEmission = 0;
                        Particle.gameObject.SetActive(false);
                        Specular.SpecularColor = Specular.DefaultColor;
                        _RainAudio.Stop();
                    }

                    _Starting = false;
                    _Stopping = false;
                }
                else
                {
                    float percent = _FadeTW.Percent;
                    if (_Stopping)
                    {
                        percent = 1.0f - percent;
                    }

                    Particle.minEmission   = Mathf.Lerp(0, _MinEmission, percent * 3);
                    Particle.maxEmission   = Mathf.Lerp(0, _MaxEmission, percent * 3);
                    Specular.SpecularColor = Color.Lerp(Specular.DefaultColor, RainSpecular, percent);
                }
            }
        }
Esempio n. 21
0
        internal IList List(Type type, IConnectinContext cc, Region region)
        {
            TimeWatch.Start("Peanut->SQL to list");
            System.Type itemstype = System.Type.GetType("System.Collections.Generic.List`1");
            itemstype = itemstype.MakeGenericType(type);
            IList result;

            if (region == null)
            {
                region = new Region(0, 99999999);
            }
            if (region.Size > DBContext.DefaultListMaxSize)
            {
                result = (IList)Activator.CreateInstance(itemstype, DBContext.DefaultListMaxSize);
            }
            else
            {
                result = (IList)Activator.CreateInstance(itemstype, region.Size);
            }
            Mappings.CommandReader cr = Mappings.CommandReader.GetReader(mBaseSql, type);
            int     index             = 0;
            Command cmd = GetCommand();

            TimeWatch.Start("Peanut->DataReader to list");
            using (IDataReader reader = cc.ExecuteReader(cmd))
            {
                TimeWatch.Start("Peanut->Read Data");
                while (reader.Read())
                {
                    if (index >= region.Start)
                    {
                        object item = Activator.CreateInstance(type);
                        cr.ReaderToObject(reader, item);
                        result.Add(item);
                        if (result.Count >= region.Size)
                        {
                            cmd.DbCommand.Cancel();
                            reader.Dispose();
                            break;
                        }
                    }
                    index++;
                }
                TimeWatch.End();
            }
            TimeWatch.End();
            TimeWatch.End();
            return(result);
        }
Esempio n. 22
0
 /// <summary>
 /// Update
 /// </summary>
 protected virtual void Update()
 {
     if (_DelayTW.IsEnabledAndOver)
     {
         _DelayTW.End();
         if (Matinee != null)
         {
             if (Seek)
             {
                 Matinee.Seek(SeekTime);
             }
             Matinee.Play();
         }
     }
 }
Esempio n. 23
0
 protected override void Update()
 {
     base.Update();
     if (_InTW.IsEnabledAndOver)
     {
         _InTW.End();
         base.Show();
         OnIn();
     }
     if (_OutTW.IsEnabledAndOver)
     {
         _OutTW.End();
         OutEnd();
         base.Hide();
     }
 }
Esempio n. 24
0
        /// <summary>
        /// 构建对应的数据库命令
        /// </summary>
        /// <param name="driver">数据库类型</param>
        /// <returns>IDbCommand</returns>
        public IDbCommand CreateCommand(IDriver driver)
        {
            TimeWatch.Start("Peanut->Create IDbCommand");
            IDbCommand cmd = driver.Command;

            cmd.CommandText = driver.ReplaceSql(Text.ToString());
            cmd.CommandType = CommandType;
            DbCommand       = cmd;
            for (int i = 0; i < Parameters.Count; i++)
            {
                Parameter p = Parameters[i];
                cmd.Parameters.Add(driver.CreateParameter(p.Name, p.Value, p.Direction));
            }
            TimeWatch.End();
            return(cmd);
        }
Esempio n. 25
0
        public IList <T> GetValues <T>(Command cmd, Region region)
        {
            TimeWatch.Start("Peanut->Execute SQL Return Values");
            List <T> result = null;
            object   value;

            if (region == null)
            {
                region = new Region(0, 9999999);
            }
            if (region.Size > DBContext.DefaultListMaxSize)
            {
                result = new List <T>(DBContext.DefaultListMaxSize);
            }
            else
            {
                result = new List <T>(region.Size);
            }
            using (IDataReader reader = ExecuteReader(cmd))
            {
                int index = 0;
                while (reader.Read())
                {
                    if (index >= region.Start)
                    {
                        value = reader[0];
                        if (value != DBNull.Value)
                        {
                            result.Add((T)Uility.ChangeType(value, typeof(T)));
                        }
                        else
                        {
                            result.Add(default(T));
                        }
                        if (result.Count == region.Size)
                        {
                            cmd.DbCommand.Cancel();
                            reader.Close();
                            break;
                        }
                    }
                    index++;
                }
            }
            TimeWatch.End();
            return(result);
        }
Esempio n. 26
0
 /// <summary>
 /// Update
 /// </summary>
 protected virtual void Update()
 {
     if (_DelayTW.IsEnabledAndOver)
     {
         _DelayTW.End();
         if (Objects != null)
         {
             foreach (var item in Objects)
             {
                 if (item != null)
                 {
                     item.SetActive(Active);
                 }
             }
         }
     }
 }
Esempio n. 27
0
        /// <summary>
        /// Update is called once per frame
        /// </summary>
        protected override void Update()
        {
            if (Global.IsGamePaused)
            {
                return;
            }
            _Euler.Update(PunctureSmoothing);
            transform.rotation = Quaternion.Euler(_Euler.Current);

            if (!_UpdateTW.IsEnabled || _UpdateTW.IsEnabledAndOver)
            {
                _UpdateTW.End();
                enabled = false;
            }

            base.Update();
        }
Esempio n. 28
0
 /// <summary>
 /// Update
 /// </summary>
 protected virtual void Update()
 {
     if (_DelayTW.IsEnabledAndOver)
     {
         _DelayTW.End();
         if (Behaviours != null)
         {
             foreach (var item in Behaviours)
             {
                 if (item != null)
                 {
                     item.enabled = Enable;
                 }
             }
         }
     }
 }
Esempio n. 29
0
        public IList ListProc(Type entity, object parameter)
        {
            TimeWatch.Start("Peanut->Execute Proce Return List");
            System.Type itemstype = System.Type.GetType("System.Collections.Generic.List`1");
            itemstype = itemstype.MakeGenericType(entity);
            IList result = (IList)Activator.CreateInstance(itemstype);

            Mappings.ProcDataReader dr = Mappings.ProcDataReader.GetDataReader(parameter.GetType(), entity);
            using (IDataReader reader = mHandler.ExecProcReader(parameter))
            {
                while (reader.Read())
                {
                    object item = Activator.CreateInstance(entity);
                    dr.ReaderToObject(reader, item);
                    result.Add(item);
                }
            }
            TimeWatch.End();
            return(result);
        }
Esempio n. 30
0
 protected override void Update()
 {
     if (Global.IsGamePaused)
     {
         return;
     }
     if (_MoveTimeTW.IsEnabled)
     {
         if (_MoveTimeTW.IsOver)
         {
             _MoveTimeTW.End();
             ShowExplosion();
             DestroySelf();
         }
         else
         {
             _BulletObject.position = Vector3.Lerp(_BulletStartPosition, transform.position, _MoveTimeTW.Percent);
         }
     }
     base.Update();
 }