예제 #1
0
        public virtual void PerformHover(Point point)
        {
            if (Disabled || OutOfBounds)
            {
                return;
            }

            if (HoverAction != null && Bounds.Contains(point))
            {
                HoverAction?.Invoke(point, true, this);
                WasHover = true;
            }
            else if (HoverAction != null && WasHover)
            {
                HoverAction?.Invoke(point, false, this);
                WasHover = false;
            }

            foreach (UIElement child in Children.Where(c => c.Visible))
            {
                Task.Run(() =>
                {
                    child.PerformHover(point);
                });
            }
        }
예제 #2
0
    static void Receive(TcpClient socket)
    {
        NetworkStream readStream = socket.GetStream();

        try {
            StreamReader readerStream = new StreamReader(readStream);

            string returnData;
            returnData = readerStream.ReadLine();
            Debug.Log("Receive: " + returnData);

            if (returnData.Contains("LoginAck"))
            {
                Login.OnClickLogin(returnData);
            }
            else if (returnData.Contains("RankAck"))
            {
                HoverAction.ParseData(returnData);
            }
        }
        catch (SocketException ex) {
            if (ex.SocketErrorCode == SocketError.WouldBlock ||
                ex.SocketErrorCode == SocketError.IOPending ||
                ex.SocketErrorCode == SocketError.NoBufferSpaceAvailable)
            {
                //socket buffer is probably empty, wait and try again
                Debug.Log("Thread Sleep!");
                Thread.Sleep(100);
            }
            else            //any serious error occurr
            {
                throw ex;
            }
        }
    }
예제 #3
0
        protected override void OnEnable()
        {
            base.OnEnable();

            m_HoverAction = (HoverAction)m_Action;

            m_AmplitudeProp = serializedObject.FindProperty("m_Amplitude");
        }
예제 #4
0
        public override void PerformHover(Point point)
        {
            if ((HoverAction != null || Scrollable) && Bounds.Contains(point))
            {
                HoverAction?.Invoke(point, true, this);
                WasHover = true;
            }
            else if ((HoverAction != null || Scrollable) && WasHover)
            {
                HoverAction?.Invoke(point, false, this);
                WasHover = false;
            }

            foreach (UIElement child in Children.Where(c => c.Visible))
            {
                child.PerformHover(point);
            }
        }
예제 #5
0
        /// <summary>
        /// get the traveler's HoverAction choice
        /// </summary>
        /// <returns>HoverAction</returns>
        public HoverAction DisplayGetHoverActionChoice()
        {
            HoverAction hoverActionChoice = HoverAction.None;

            ConsoleUtil.HeaderText = "Choose a Hover Action";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Enter one of the following actions.");
            ConsoleUtil.DisplayMessage("");
            foreach (HoverAction action in Enum.GetValues(typeof(HoverAction)))
            {
                ConsoleUtil.DisplayMessage(action.ToString());
            }

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayPromptMessage("Enter a hover action:");
            bool validResponse = false;

            if (Enum.TryParse <HoverAction>(Console.ReadLine(), out hoverActionChoice))
            {
                validResponse = true;
            }
            else
            {
                ConsoleUtil.DisplayMessage("");
                ConsoleUtil.DisplayMessage("You must choose a from the list above.");
                ConsoleUtil.DisplayMessage("Please re-enter an option.");
            }

            SoundPlayer player = new SoundPlayer();

            player.SoundLocation = AppDomain.CurrentDomain.BaseDirectory + "\\hoverboard.wav";
            player.Play();
            DisplayContinuePrompt();

            return(hoverActionChoice);
        }
예제 #6
0
        public HoverAction GetHoverAction()
        {
            HoverAction hoverAction = HoverAction.None;

            BatteryPower = 95;
            Random random = new Random();

            if (random.Next(1, 100) > BatteryPower)
            {
                hoverAction = HoverAction.Hover;
            }
            else if (random.Next(1, 100) > BatteryPower)
            {
                hoverAction = HoverAction.Cruise;
            }
            else if (random.Next(1, 100) < BatteryPower)
            {
                hoverAction = HoverAction.Speed;
            }



            return(hoverAction);
        }
예제 #7
0
 public HoverTimer(HoverAction action, TreeNode node)
 {
     _action = action;
     _node   = node;
 }