public static void Log(params object[] toLog)
    {
        string log = "";

        if (toLog != null)
        {
            foreach (object item in toLog)
            {
                log += ObjectToString(item);
                log += ", ";
            }

            if (!string.IsNullOrEmpty(log))
            {
                log = log.Substring(0, log.Length - 2);
            }
        }

        if (LogToScreen)
        {
            ScreenLogger.Log(log);
        }

        if (logToConsole)
        {
            Debug.Log(log);
        }
    }
Exemple #2
0
        protected void StartWork(String port)
        {
            m_monitor.Start();
            var endpoint = $"tcp://{TCPHostAdress}:{port}";

            m_socket.Bind(endpoint);

            ScreenLogger.Log($"Socket binded to endpoint: {endpoint}", LogObject.System);
        }
Exemple #3
0
        //if already called
        protected void StopWork()
        {
            var endpoint = m_socket.LastEndpoint;

            m_cancelCondition = false;
            m_loopTask.Wait();
            m_monitor.Close();
            m_socket.Close();
            m_context.Terminate();

            ScreenLogger.Log($"Socket stopped work: {endpoint}", LogObject.System);
        }
Exemple #4
0
        public static void Log(params object[] toLog)
        {
            if (logToScreen)
            {
                ScreenLogger.Log(LogToString(toLog));
            }

            if (logToConsole)
            {
                UnityEngine.Debug.Log(LogToString(toLog));
            }
        }
        protected void StartWork(String port)
        {
            m_tcpSocketMonitor.Start();
            //m_udpSocketMonitor.Start();

            var tcp_endpoint = $"tcp://{TCPHostAdress}:{port}";

            //var udp_endpoint = $"udp://{TCPHostAdress}:{port}";

            m_tcpSocket.Bind(tcp_endpoint);
            //m_udpSocket.Bind(udp_endpoint);

            ScreenLogger.Log($"Main TCP socket binded to endpoint: {tcp_endpoint}", LogObject.System);
            //ScreenLogger.Log($"Main UDP socket binded to endpoint: {udp_endpoint}", LogObject.System);
        }
        protected void StopWork()
        {
            var tcp_endpoint = m_tcpSocket.LastEndpoint;

            //var udp_endpoint = m_udpSocket.LastEndpoint;

            m_cancelConddition = false;
            m_loopTask.Wait();

            m_tcpSocketMonitor.Close();
            //m_udpSocketMonitor.Close();

            m_tcpSocket.Close();
            //m_udpSocket.Close();

            m_context.Terminate();

            ScreenLogger.Log($"Main TCP socket stopped work: {tcp_endpoint}", LogObject.System);
            //ScreenLogger.Log($"Main UDP socket stopped work: {udp_endpoint}", LogObject.System);
        }
Exemple #7
0
        public void Log(string error, LOG_TYPE type)
        {
            lock (singleton)
            {
                if (!ScreenLoggerShowing && m_ScreenLogger != null)
                {
                    ScreenLoggerShowing = true;
                    m_ScreenLogger.ShowForm();
                }

                Console.WriteLine(error);

                if (m_ScreenLogger != null)
                {
                    m_ScreenLogger.Log(error);
                }


                FileLogging.Set(error);
            }
        }
Exemple #8
0
    void Start()
    {
        var uiRoot = m_UiRoot.rootVisualElement;

        // CONTAINER
        m_Container                = new VisualElement();
        m_Container.name           = "build-menu-container";
        m_Container.style.display  = DisplayStyle.None;
        m_Container.style.position = Position.Absolute;
        m_Container.style.width    = 398;
        m_Container.style.height   = 398;

        // BACKGROUND
        var backgroundLarge = new VisualElement();

        backgroundLarge.style.visibility      = Visibility.Visible;
        backgroundLarge.style.position        = Position.Absolute;
        backgroundLarge.style.backgroundImage = new StyleBackground(spriteBackgroundLarge);
        backgroundLarge.style.width           = Length.Percent(100);
        backgroundLarge.style.height          = Length.Percent(100);
        backgroundLarge.style.left            = Length.Percent(-50);
        backgroundLarge.style.top             = Length.Percent(-50);

        m_Container.Add(backgroundLarge);

        // ICON
        {
            m_IconWrapper = new VisualElement();

            // CALLBACK HANDLERS
            m_IconWrapper.RegisterCallback <PointerEnterEvent>(e =>
            {
                m_Logger.Log($"PointerEnterEvent ({e.localPosition})");
                SetIconState(IconState.Selected);
            });
            m_IconWrapper.RegisterCallback <PointerMoveEvent>(e =>
            {
                m_Logger.Log($"PointerMoveEvent ({e.localPosition})");
            });
            m_IconWrapper.RegisterCallback <PointerLeaveEvent>(e =>
            {
                m_Logger.Log($"PointerLeaveEvent ({e.localPosition})");
                SetIconState(IconState.Active);
            });



            // Set icon position
            var centerX = 100;
            var centerY = 0;
            m_IconWrapper.style.left = (-65 / 2) + centerX;
            m_IconWrapper.style.top  = (-77 / 2) + centerY;

            m_IconSelected = new VisualElement();
            m_IconSelected.style.visibility      = Visibility.Hidden;
            m_IconSelected.style.position        = Position.Absolute;
            m_IconSelected.style.backgroundImage = new StyleBackground(spriteIcon2);
            m_IconSelected.style.width           = 65;
            m_IconSelected.style.height          = 77;
            m_IconWrapper.Add(m_IconSelected);

            m_IconActive = new VisualElement();
            m_IconActive.style.visibility      = Visibility.Hidden;
            m_IconActive.style.position        = Position.Absolute;
            m_IconActive.style.backgroundImage = new StyleBackground(spriteIcon1);
            m_IconActive.style.width           = 65;
            m_IconActive.style.height          = 77;

            m_IconWrapper.Add(m_IconActive);

            m_IconDisabled = new VisualElement();
            m_IconDisabled.style.visibility      = Visibility.Hidden;
            m_IconDisabled.style.position        = Position.Absolute;
            m_IconDisabled.style.backgroundImage = new StyleBackground(spriteIcon0);
            m_IconDisabled.style.width           = 65;
            m_IconDisabled.style.height          = 77;
            m_IconWrapper.Add(m_IconDisabled);

            m_Container.Add(m_IconWrapper);
        }

        // Add container to root
        uiRoot.Add(m_Container);

        SetIconState(IconState.Active);
    }