Beispiel #1
0
    bool initWithTwoActions(FiniteTimeAction action1, FiniteTimeAction action2)
    {
        UnityEngine.Debug.Assert(action1 != null, "");
        UnityEngine.Debug.Assert(action2 != null, "");

        bool ret = false;

        float d1 = action1.Duration;
        float d2 = action2.Duration;

        if (base.InitWithDuration(Mathf.Max(d1, d2)))
        {
            One = action1;
            Two = action2;

            if (d1 > d2)
            {
                Two = SequenceAction.CreateWithTwoActions(action2, DelayTime.Create(d1 - d2));
            }
            else if (d1 < d2)
            {
                One = SequenceAction.CreateWithTwoActions(action1, DelayTime.Create(d2 - d1));
            }

            ret = true;
        }

        return(ret);
    }
Beispiel #2
0
        public void flipRaining()
        {
            if(isRaining){
            //Support.SoundSystem.Instance.Play("rain.wav");
            var rainsprite = Support.TiledSpriteFromFile("/Application/assets/rain_Sheet.png", 9, 1);
            var raincountX = Camera.CalcBounds().Max.X/rainsprite.Quad.X.X;
            var raincountY = Camera.CalcBounds().Max.Y/rainsprite.Quad.Y.Y;
            var currentPos = new Vector2(0, 20);
            for(var i = 0; i < raincountY; i++){
              for(int j = 0; j < raincountX; j++){
            rainsprite = Support.TiledSpriteFromFile("/Application/assets/rain_Sheet.png", 9, 1);
            rainsprite.CenterSprite();
            rainsprite.Position = currentPos;
            rainsprite.VertexZ = 1;
            this.AddChild(rainsprite,1);

            rain.Add(rainsprite);
            var RainAnimation = new Support.AnimationAction(rainsprite, 9, 1, 1.0f, looping: true);
            var Wait = new DelayTime((float)rng.NextDouble() * 2);
            var seq = new Sequence();
            seq.Add(Wait);
            seq.Add(RainAnimation);
            rainsprite.RunAction(seq);

            currentPos += new Vector2(rainsprite.Quad.X.X, 0);
              }
              currentPos = new Vector2(0, currentPos.Y + rainsprite.Quad.Y.Y);
            }
              } else {
            for(int i = 0; i < rain.Count; i++){
              GameScene.Instance.RemoveChild(rain[i], true);
            }
            rain.Clear();
              }
        }
Beispiel #3
0
    static public DelayTime Create(float d)
    {
        DelayTime obj = new DelayTime();

        obj.InitWithDuration(d);
        return(obj);
    }
Beispiel #4
0
        public bool InitWithTwoActions(FiniteTimeAction action1, FiniteTimeAction action2)
        {
            if (action1 == null || action2 == null)
            {
                Debug.LogError("Sequence::initWithTwoActions error: action is null!!");
                return(false);
            }
            bool ret = false;
            var  d1  = action1.Duration;
            var  d2  = action2.Duration;

            if (base.InitWithDuration(Math.Max(d1, d2)))
            {
                one = action1;
                two = action2;
                if (d1 > d2)
                {
                    two = Sequence.CreateWithTwoActions(action2, DelayTime.Create(d1 - d2));
                }
                else if (d1 < d2)
                {
                    one = Sequence.CreateWithTwoActions(action1, DelayTime.Create(d2 - d1));
                }
                ret = true;
            }
            return(ret);
        }
Beispiel #5
0
        /// <summary>
        /// Метод, привязывающий параметры эффекта дилэй плагина к редактору.
        /// </summary>
        private void BindDelay(DelayManager delay)
        {
            var color = (Brush)Resources["delayKnobColor"];

            DelayTime.AttachTo(delay.TimeManager, color,
                               Converters.DelayTimeToString);

            DelayFeedback.AttachTo(delay.FeedbackManager, color,
                                   Converters.PercentsToString);

            DelayMix.AttachTo(delay.MixManager, color,
                              Converters.PercentsToString);

            DelayStereoMode.AttachTo(delay.ModeManager, color,
                                     Converters.DelayModeToString);

            DelayStereoAmount.AttachTo(delay.StereoAmountManager, color,
                                       Converters.StereoAmountToString);

            DelayInvert.AttachTo(delay.InvertManager, color,
                                 Converters.InvertToString);

            DelayLfoDepth.AttachTo(delay.LfoDepthManager, color,
                                   Converters.PercentsToString);

            DelayLfoRate.AttachTo(delay.LfoRateManager, color,
                                  Converters.DelayLfoRateToString);
        }
Beispiel #6
0
        /// <summary>
        /// Returns true if ComAdobeCqSocialUgcbaseDispatcherImplFlushServiceImplProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeCqSocialUgcbaseDispatcherImplFlushServiceImplProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeCqSocialUgcbaseDispatcherImplFlushServiceImplProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ThreadPoolSize == other.ThreadPoolSize ||
                     ThreadPoolSize != null &&
                     ThreadPoolSize.Equals(other.ThreadPoolSize)
                     ) &&
                 (
                     DelayTime == other.DelayTime ||
                     DelayTime != null &&
                     DelayTime.Equals(other.DelayTime)
                 ) &&
                 (
                     WorkerSleepTime == other.WorkerSleepTime ||
                     WorkerSleepTime != null &&
                     WorkerSleepTime.Equals(other.WorkerSleepTime)
                 ));
        }
Beispiel #7
0
 protected override byte[] GetExtensionData()
 {
     return(Label.GetBytes().Concatenate(BlockSize.GetBytes(),
                                         Packed.Print(),
                                         DelayTime.GetBytes(),
                                         ColorIndex.GetBytes()));
 }
Beispiel #8
0
        public static DelayTime Create(float d)
        {
            DelayTime action = new DelayTime();

            if (action != null && action.InitWithDuration(d))
            {
                return(action);
            }
            return(null);
        }
Beispiel #9
0
    //deprecated
    public void FlipFinal(float delay = 0f, bool withAnimation = true)
    {
        /*
         #region NEW_ADD
         * int sceneIndex = UnityEngine.SceneManagement.SceneManager.GetActiveScene ().buildIndex;
         * if (sceneIndex != (int)EScene.SCENE_Demo) {
         *      return;
         * }
         #endregion
         */
        Vector3 oldPos = transform.position;

        if (withAnimation)
        {
            _flipActionList.Clear();

            FiniteTimeAction delayTime = null;
            if (delay > 0f)
            {
                delayTime = DelayTime.Create(delay);
            }

            //上移
            FiniteTimeAction mby = MoveBy.Create(0.2f, Vector3.up * 10f);
            //翻过来
            FiniteTimeAction mbt1 = RotateBy.Create(0.2f, Vector3.forward, 180f, Space.Self);
            //下移到原来的地方
            FiniteTimeAction mbt2 = MoveTo.Create(0.2f, oldPos);

            FiniteTimeAction mbt3 = MoveTo.Create(0.2f, Vector3.up * 5f);
            FiniteTimeAction mbt4 = RotateTo.Create(0.2f, Vector3.zero);

            FiniteTimeAction mbt5 = InvokeAction.Create(delegate(GameObject target, object userdata) {
                //TableController.Instance.SetCurrentPlayedTile (this);
            });
            if (delayTime != null)
            {
                _flipActionList.Add(delayTime);
            }
            _flipActionList.Add(mby);
            _flipActionList.Add(mbt1);
            _flipActionList.Add(mbt2);
            _flipActionList.Add(mbt3);
            _flipActionList.Add(mbt4);
            _flipActionList.Add(mbt5);
            ActionManager.Instance.RunAction(gameObject, _flipActionList);
        }
        else
        {
            //transform.Rotate (Vector3.forward, 180f, Space.Self);
            transform.rotation = Quaternion.identity;
            transform.position = Vector3.up * 5f;
            //TableController.Instance.SetCurrentPlayedTile (this);
        }
    }
Beispiel #10
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            float targetTime = Time.time + DelayTime.GetFirstValue(payload.Data);

            DelayJobs.Add(JobManager.Instance.StartJob(
                              Delay(payload, targetTime), jobName: "Delay", startImmediately: true, maxExecutionsPerFrame: 1)); // mex is 1 for testing
            // if (JobManager.Instance.IsJobRegistered(jobId))
            //     yield return null;

            yield break;
        }
            /// <summary>
            /// 保存播放类
            /// </summary>
            public void Save()
            {
                Dictionary <string, string> buff = new Dictionary <string, string>();

                buff.Add("Play", Play.ToString());
                buff.Add("TVIndex", TVIndex.ToString());
                buff.Add("DelayTime", DelayTime.ToString());
                buff.Add("Player", Player.ToString());
                for (int i = 0; i < Info.Length; i++)
                {
                    buff.Add(string.Format("Info{0}", i), Info[i]);
                }
                All.Class.FileIO.Write(string.Format("{0}{1}.txt", cDataXml.XMLDirectory, Player), All.Class.SSFile.Dictionary2Text(buff), System.IO.FileMode.Create);
            }
Beispiel #12
0
    /// <summary>
    /// Delay a task for a specify time.
    /// </summary>
    public static void Delay(float time, Action task)
    {
#if UNITY_EDITOR
        if (!EditorApplication.isPlayingOrWillChangePlaymode)
        {
            Debug.LogError(
                "Scheduler can not work when application is not playing.");
            return;
        }
#endif

        var delayTime = new DelayTime(
            Time.realtimeSinceStartup + time, task);
        delayTasks.Add(delayTime);
    }
Beispiel #13
0
    public virtual void DoAnimate(int id, Function onSpecial, int loop, Function onFinished, float speed = 1.0f, bool stopAllFirst = false)
    {
        if (stopAllFirst)
        {
            stopAllActions();
        }
        ActionInterval act;

        cca.Animation ani;
        if (!m_animations.TryGetValue(id, out ani))
        {
            if (id == kActionDie)
            {
                act = new FadeOut(0.1f);
            }
            else
            {
                act = new DelayTime(0.2f);
            }
            if (onSpecial != null)
            {
                act = new Sequence(act, new CallFunc(onSpecial));
            }
        }
        else
        {
            act = new Animate(ani, delegate(int index, ref object data) {
                if (onSpecial != null)
                {
                    onSpecial();
                }
            });
        }

        if (loop == CONST_LOOP_FOREVER)
        {
            act = new RepeatForever(act);
        }
        else
        {
            act = new Sequence(new Repeat(act, (uint)loop), new CallFunc(onFinished));
        }

        Speed action = new Speed(act, speed);

        action.tag = id;
        runAction(action);
    }
Beispiel #14
0
        public HttpResponseMessage Save()
        {
            try
            {
                var result = DelayTimeBusiness.Get();

                if (result == null || !result.Any())
                {
                    var entity = new DelayTime()
                    {
                        Id = 1, Name = "15 minutos", TimeMinutes = 15
                    };
                    DelayTimeBusiness.Save(entity);
                    entity = new DelayTime()
                    {
                        Id = 2, Name = "30 minutos", TimeMinutes = 30
                    };
                    DelayTimeBusiness.Save(entity);
                    entity = new DelayTime()
                    {
                        Id = 3, Name = "1 hora", TimeMinutes = 60
                    };
                    DelayTimeBusiness.Save(entity);
                    entity = new DelayTime()
                    {
                        Id = 4, Name = "4 horas", TimeMinutes = 240
                    };
                    DelayTimeBusiness.Save(entity);
                    entity = new DelayTime()
                    {
                        Id = 5, Name = "1 dia", TimeMinutes = 1440
                    };
                    DelayTimeBusiness.Save(entity);

                    result = DelayTimeBusiness.Get();
                }

                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception exc)
            {
                var logId = LogBusiness.Error(exc);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId)));
            }
        }
Beispiel #15
0
    public virtual void DoLinkUnitToUnit(UnitNode from, UnitNode to, int id, Function onSpecial, int loop, Function onFinished)
    {
        ActionInterval act;

        cca.Animation ani;
        if (!m_animations.TryGetValue(id, out ani))
        {
            if (id == kActionDie)
            {
                act = new FadeOut(0.1f);
            }
            else
            {
                act = new DelayTime(0.2f);
            }
            if (onSpecial != null)
            {
                act = new Sequence(act, new CallFunc(onSpecial));
            }
        }
        else
        {
            visible = false;
            act     = new LinkAnimate(ani, delegate(int index, ref object data) {
                if (onSpecial != null)
                {
                    onSpecial();
                }
            }, from, to);
        }

        if (loop == CONST_LOOP_FOREVER)
        {
            act = new RepeatForever(act);
        }
        else
        {
            act = new Sequence(new Repeat(act, (uint)loop), new CallFunc(onFinished));
        }

        //m_node.stopActionByTag(id);
        act.tag = id;
        runAction(act);
    }
Beispiel #16
0
    //deprecated
    public void Flip(float delay = 0f, bool withAnimation = true)
    {
        /*
         #region NEW_ADD
         * int sceneIndex = UnityEngine.SceneManagement.SceneManager.GetActiveScene ().buildIndex;
         * if (sceneIndex != (int)EScene.SCENE_Demo) {
         *      return;
         * }
         #endregion
         */
        Vector3 oldPos = transform.position;

        if (withAnimation)
        {
            _flipActionList.Clear();

            FiniteTimeAction delayTime = null;
            if (delay > 0f)
            {
                delayTime = DelayTime.Create(delay);
            }

            //上移
            FiniteTimeAction mby = MoveBy.Create(0.2f, Vector3.up * 10f);
            //翻过来
            FiniteTimeAction mbt1 = RotateBy.Create(0.2f, Vector3.forward, 180f, Space.Self);
            //下移到原来的地方
            FiniteTimeAction mbt2 = MoveTo.Create(0.2f, oldPos);
            if (delayTime != null)
            {
                _flipActionList.Add(delayTime);
            }
            _flipActionList.Add(mby);
            _flipActionList.Add(mbt1);
            _flipActionList.Add(mbt2);
            ActionManager.Instance.RunAction(gameObject, _flipActionList);
        }
        else
        {
            transform.Rotate(Vector3.forward, 180f, Space.Self);
        }
    }
Beispiel #17
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ThreadPoolSize != null)
         {
             hashCode = hashCode * 59 + ThreadPoolSize.GetHashCode();
         }
         if (DelayTime != null)
         {
             hashCode = hashCode * 59 + DelayTime.GetHashCode();
         }
         if (WorkerSleepTime != null)
         {
             hashCode = hashCode * 59 + WorkerSleepTime.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #18
0
    void CallFuncTest()
    {
        btn_text.text = "点击停止";
        var action = Sequence.Create(
            CallFunc.Create(CallBackO, "延时0.5秒"),
            DelayTime.Create(0.5f),
            CallFunc.Create(CallBackO, "图片移动"),
            MoveTo.Create(1f, 200, 100).InitSubjectTransform(image.transform),
            MoveTo.Create(1f, 0, 0).InitSubjectTransform(image.transform),
            CallFunc.Create(CallBackO, "颜色渐变"),
            ColorTo.Create(0.5f, 1, 0, 0, 1f).InitSubjectComponent(image),
            ColorTo.Create(0.5f, 0, 1, 0, 1f).InitSubjectComponent(image),
            ColorTo.Create(0.5f, 0, 0, 1, 1f).InitSubjectComponent(image),
            CallFunc.Create(CallBackO, "颜色reset"),
            ColorTo.Create(0.5f, 1, 1, 1, 1).InitSubjectComponent(image),
            CallFunc.Create(CallBackO, "渐隐"),
            FadeOut.Create(1f).InitSubjectComponent(image),
            CallFunc.Create(CallBackO, "渐出"),
            FadeIn.Create(1f).InitSubjectComponent(image),
            CallFunc.Create(CallBackO, "1秒闪烁5次"),
            Blink.Create(1f, 5),
            CallFunc.Create(CallBackO, "二阶贝塞尔曲线"),
            BezierTo.Create(2.0f, new Vector3(200, 100, 0), new Vector3(-100, 50, 0), new Vector3(100, 80, 0)).InitSubjectTransform(image.transform),
            CallFunc.Create(CallBackO, "移动回原点"),
            MoveTo.Create(1f, 0, 0).InitSubjectTransform(image.transform),
            CallFunc.Create(CallBackO, "边移动边放大"),
            Spawn.Create(MoveTo.Create(1.0f, 200, 100f), ScaleTo.Create(1.0f, 3.0f, 3.0f, 3.0f)),
            CallFunc.Create(CallBackO, "缩放位置回原位"),
            Spawn.Create(MoveTo.Create(1.0f, 0, 0), ScaleTo.Create(1.0f, 1f, 1f, 1f)),
            NumberBy.Create(2.0f, "数字跳跃,从100到200:{0:f2}", 100, 100).InitSubjectComponent(text),
            DelayTime.Create(0.5f),
            NumberTo.Create(2.0f, "数字跳跃,从200到0:{0:f2}", 200, 0).InitSubjectComponent(text),
            DelayTime.Create(0.5f),
            CallFunc.Create(CallBackO, "Image Filled"),
            FillAmountTo.Create(1.5f, 0f).InitSubjectComponent(image),
            FillAmountTo.Create(1.5f, 1.0f).InitSubjectComponent(image),
            CallFunc.Create(CallBackO, "reset"),
            CallFunc.Create(CallBackO, "旋转 放大2倍,复原。重复3次"),
            Repeat.Create(Spawn.Create(
                              RotationBy.Create(1.0f, 0, 0, 360f),
                              Sequence.Create(
                                  ScaleTo.Create(0.5f, 2.0f, 2.0f, 2.0f),
                                  ScaleTo.Create(0.5f, 1.0f, 1.0f, 1.0f))).InitSubjectTransform(image.transform), 3),
            ExtraAction.Create()
            );

        float toX        = 300f;
        var   easeAction = Sequence.Create(
            CallFunc.Create(CallBackO, "变速运动演示,图一正常,图二是变速运动"),
            DelayTime.Create(1f),
            CallFunc.Create(CallBackO, "当前变速是EaseIn"),
            DelayTime.Create(0.5f),
            Spawn.Create(
                MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image.transform),
                EaseIn.Create(MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)),
            CallFunc.Create(CallBackO, "复位"),
            Spawn.Create(
                MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image.transform),
                EaseIn.Create(MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)),

            CallFunc.Create(CallBackO, "当前变速是EaseOut"),
            DelayTime.Create(0.5f),
            Spawn.Create(
                MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image.transform),
                EaseOut.Create(MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)),
            CallFunc.Create(CallBackO, "复位"),
            Spawn.Create(
                MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image.transform),
                EaseOut.Create(MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)),

            CallFunc.Create(CallBackO, "当前变速是EaseInOut"),
            DelayTime.Create(0.5f),
            Spawn.Create(
                MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image.transform),
                EaseInOut.Create(MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)),
            CallFunc.Create(CallBackO, "复位"),
            Spawn.Create(
                MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image.transform),
                EaseInOut.Create(MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)),
            CallFunc.Create(CallBackO, "变速运动未完待续"),
            DelayTime.Create(1f),
            ExtraAction.Create()
            );

        CCActionManager.Instance.AddAction(Sequence.Create(action, easeAction, CallFunc.Create(CallBackEnd)), transform);
    }
Beispiel #19
0
 [DllImport("DLL7000.dll")]  //, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] //, EntryPoint = "OutPutData_gSub", CharSet = CharSet.Auto, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
 public static extern int OutPutData_gSub(int pLngAdjust, int pLngSourceType, int ComPort, int pIntPhase, int pIntStatus, int pIntSequence, float pSngVoltage, float pSngCurrent, float pSngFrequency, int pStrIABC, int pIntIB, int pStrLC, int pIntWave, int pIntWaveTimes, int pStrUWave, int pStrIWave, ref DelayTime timedelay);
Beispiel #20
0
 [DllImport("DLL7000.dll")] //CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall
 public static extern int DSPOutput(int pLngAdjust, int ComPort, int pIntID, int pIntPhase, float pSngFrequency, float Ua, float Ub, float Uc, float Ia, float Ib, float Ic, float DUab, float DUac, float DUIa, float DUIb, float DUIc, int WaveType, ref DelayTime timedelay);
 /// <summary>
 /// アラーム遅延時間の設定を記録します
 /// </summary>
 public static void SaveDelayTime(DelayTime sense)
 {
     //列挙型を数値に変換して保存する
     PlayerPrefs.SetInt(delayTimeKey, (int)sense);
 }
Beispiel #22
0
 public DelayTime Reverse()
 {
     return(DelayTime.Create(Duration));
 }
Beispiel #23
0
 public override Action Reverse()
 {
     return(DelayTime.Create(duration));
 }
Beispiel #24
0
        public static int Save(DelayTime entity)
        {
            var repository = new DelayTimeRepository();

            return(repository.InsertOne(entity));
        }