private void OnAttack(MessageDef type, object[] payload)
        {
            var msg = new MsgCastSkill();

            msg.skillid = 100;
            this.Manager.SendPacket((int)MsgTypeCmd.CastSkill, msg);
        }
Beispiel #2
0
        private void OnBroadcast(MessageDef type, params object[] payload)
        {
            var e   = this.world.CreateEntity();
            var msg = e.AddTrait <Message>();

            msg.Type    = type;
            msg.Payload = payload;
        }
        private void OnJoyStickDragging(MessageDef type, object[] payload)
        {
            var x     = (float)payload[0];
            var y     = (float)payload[1];
            var angle = (int)Vector2.Angle(Vector2.right, new Vector2(x, y));

            SendJoyStick(y > 0 ? 360 - angle : angle);
        }
Beispiel #4
0
        private void OnRemovePlayer(MessageDef message, object[] payload)
        {
            var        id = (ulong)payload[0];
            GameObject go = null;

            if (this.huds.TryGetValue(id, out go))
            {
                GameObject.Destroy(go);
                this.huds.Remove(id);
            }
        }
        public bool Off(MessageDef type, Action <MessageDef, object[]> handler)
        {
            if (null == handler)
            {
                return(false);
            }

            LazySet <Action <MessageDef, object[]> > set = null;

            if (!this.handlers.TryGetValue(type, out set))
            {
                return(false);
            }

            return(set.Remove(handler));
        }
Beispiel #6
0
        private void OnAddPlayer(MessageDef message, object[] payload)
        {
            var id = (ulong)payload[0];

            if (!this.huds.ContainsKey(id))
            {
                var go = GameObject.Instantiate <GameObject>(this.hudTemplate);
                go.transform.SetParent(this.hudTemplate.transform.parent);
                go.transform.localScale = Vector3.one;

                var e      = Game.GetEntityById(id);
                var name   = go.GetComponentInChildren <Text>();
                var player = e.GetTrait <Player>();
                name.text = player.Data.name;

                this.huds.Add(e.Id, go);
            }
        }
 private void OnExitMatch(MessageDef message, object[] payload)
 {
     this.manager.Exit();
     this.exited = true;
 }
 private void OnReborn(MessageDef message, object[] payload)
 {
     this.manager.Reborn();
 }
Beispiel #9
0
 public static bool Off(MessageDef type, Action <MessageDef, object[]> handler)
 {
     return(Instance.observer.Off(type, handler));
 }
Beispiel #10
0
 public static void Broadcast(MessageDef type, params object[] payload)
 {
     Instance.OnBroadcast(type, payload);
 }
 private void OnJoyStickStop(MessageDef type, object[] payload)
 {
     SendJoyStick(0, 0);
 }