Ejemplo n.º 1
0
        protected override void OnMessage(MessageEventArgs e)
        {
            //Loger.Debug(ID+ $"OnMessage{e.Data.Length}:" + e.Data);
            //Loger.Debug(LZString.Decompress(e.Data));
            try
            {
                var     Json_Data = LZString.DecompressFromUint8Array(e.RawData);
                var     MsgBody   = JObject.Parse(Json_Data);
                var     id        = MsgBody.GetValue("Id").Value <ushort>();
                JObject data      = MsgBody.GetValue("Data").Value <JObject>();

                IWebSocketSession session;
                this.Sessions.TryGetSession(ID, out session);


                GameMainEntry.Instance.WebServerModule.Dispather.Dispatch(session, new MessageInfo_Json(id, data));

                /*
                 * OneThreadSynchronizationContext.Instance.Post((obj) =>
                 * {
                 *  GameMainEntry.Instance.WebServerModule.Dispather.Dispatch(session, new MessageInfo_Json(id, data));//拉到主线程处理
                 * }, null);
                 */
            }
            catch (Exception ex)
            {
                Loger.Error($"{ID} OnMessage:" + ex.ToString());
            }
            base.OnMessage(e);
        }
Ejemplo n.º 2
0
        private void BlockSignalsOnOnBlockEnd(Block block)
        {
            // 这里判断是否有状态在继续

            GetComponent <Animator>().SetTrigger(NpcData.BornAnimation);
            Log.Debug("结束 " + block.BlockName);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// NPC与玩家交互
        /// </summary>
        public void Interaction()
        {
            switch (NpcData.NpcType)
            {
            case NPCType.Normal:
                Log.Debug(NpcData.Conversation);
                Flowchart.BroadcastFungusMessage(NpcData.Conversation);
                break;

            case NPCType.Shop:
                // 打开商店界面
                GameEntry.Controller.Shop.OpenShopForm(NpcData.StoreId);
                break;
            }
        }
Ejemplo n.º 4
0
        private void BlockSignalsOnOnBlockStart(Block block)
        {
            switch (Rebana.GetPlayer().GetComponent <RebanaMovement>().Direction)
            {
            case DirectionType.Up:
                PlayIdle(DirectionType.Down);
                break;

            case DirectionType.Down:
                PlayIdle(DirectionType.Up);
                break;

            case DirectionType.Left:
                PlayIdle(DirectionType.Right);
                break;

            case DirectionType.Right:
                PlayIdle(DirectionType.Left);
                break;
            }
            Log.Debug("开始 " + block.BlockName);
        }
Ejemplo n.º 5
0
 protected override void OnError(ErrorEventArgs e)
 {
     Loger.Debug("OnError" + e.Message);
     base.OnError(e);
 }