Example #1
0
    private void GetKey(RightEvent rightEvent, LeftEvent leftEvent, UpEvent upEvent)
    {
        timeVal -= Time.deltaTime;
        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");

        if (h > 0)
        {
            if (timeVal <= 0)
            {
                timeVal = DELTIME;
                rightEvent();
            }
        }
        else if (h < 0)
        {
            if (timeVal <= 0)
            {
                timeVal = DELTIME;
                leftEvent();
            }
        }
        if (v > 0)
        {
            if (timeVal <= 0)
            {
                timeVal = DELTIME;
                upEvent();
            }
        }
    }
    void LeftClick()
    {
        IEvent eve = new LeftEvent();

        SfAddEvent.Instance.Trigger((int)ProtocalID.Move_Main, eve);
        string str = string.Format("向左 mainID:{0} ", eve.Type);

        Debug.Log(str);
    }
        public void Left(Person person)
        {
            PersonEventArgs persEvent = new PersonEventArgs()
            {
                Person = person, Time = 0
            };

            LeftEvent?.Invoke(this, persEvent);
        }
Example #4
0
    public void Initialize(LeftEvent leftEvent, RightEvent rightEvent, UpEvent upEvent, DownEvent downEvent)
    {
        Initialize();

        this._leftEvent = leftEvent;
        this._rightEvent = rightEvent;
        this._upEvent = upEvent;
        this._downEvent = downEvent;
    }
Example #5
0
 // Start is called before the first frame update
 void Start()
 {
     Debug.Log("running");
     rEvent = new RightEvent(this.NextRoad);
     lEvent = new LeftEvent(this.LastRoad);
     uEvent = new UpEvent(this.Act);
     client = new UnityClient();
     if (client.Init("192.168.16.112", 9100) < 0)
     {
         Debug.Log("Connect peer failed");
         return;
     }
     Debug.Log("Init ok");
 }
Example #6
0
        /// <summary>
        /// Processes the message
        /// </summary>
        /// <param name="connectionBase">The connection base</param>
        /// <param name="message">The playerio message</param>
        /// <param name="handled">Whether the message was already handled</param>
        public void Process(ConnectionBase connectionBase, Message message, bool handled)
        {
            WorldConnection worldCon = (WorldConnection)connectionBase;

            int userId = message.GetInt(0);

            WorldPlayer player = worldCon.Players.GetPlayer(userId);
            LeftEvent leftEvent = new LeftEvent()
            {
                Raw = message,
                Player = player
            };

            if (!handled)
            {
                worldCon.Players.Remove(userId);
            }

            connectionBase.RaiseServerEvent<LeftEvent>(leftEvent);
        }
Example #7
0
 private bool AreSame(long start, long end, ref TKey key, ref TLeft payload, ref LeftEvent active)
 => start == active.Start && end == active.End && this.keyComparerEquals(key, active.Key) && this.leftComparerEquals(payload, active.Payload);