示例#1
0
        //0-1
        private void AnwCallBack(MsgRec msg)
        {
            var    info = (Farm_Tick_Anw)msg._proto;
            double t    = info.Unixtime;


            ServerTime.Now = Clock.ConvertIntDateTime(t);
            //Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", t, "test1"));

            GlobalDispatcher.Instance.Dispatch(GlobalEvent.ServerTimeReflash);
        }
示例#2
0
文件: Plant.cs 项目: rerwr/test
        bool ReflashTime(int id, object time)
        {
            DateTime starTime = Clock.ConvertIntDateTime(StartTime);
            //结束时的系统时间
            DateTime endTime = Clock.ConvertIntDateTime(StartTime + GrothTime);

            if (endTime >= ServerTime.Now)
            {
                RemainTime = (endTime - ServerTime.Now).TotalSeconds;
            }
            else
            {
                RemainTime = 0;
            }
            //成熟所剩余的时间,结果的时间减去现在的时间
            //                    Debug.Log(starTime);
            //根据服务器时间与当前时间计算出已经生长百分比
            HasGrouthTime = (ServerTime.Now - starTime).TotalSeconds;


            //剩余时间bizh
            percentage = HasGrouthTime / GrothTime;

            //            DateTime t = ConvertIntDateTime(remainTime);
            //            Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", t.ToString(" HH:mm:ss"), "test1"));


            //植物有五种状态,从0开始数
            double i = percentage * 4;


            if (i > 4)
            {
                i = 4;
            }
            if (i <= 0)
            {
                i = 0;
            }
            //对类型赋值
            CurrentType = (int)i;

            //            Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", "当前种植状态", CurrentType));

//            Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", Name, i));

            return(false);
        }