Пример #1
0
 private void OnGUI()
 {
     m_isActive = m_chatText.gameObject.activeInHierarchy;
     if (!m_qmunicator.IsActive(false) || !m_isActive)
     {
         return;
     }
     if (m_unreadMsgIndicator.activeSelf)
     {
         m_unreadMessages = 0;
         m_unreadMsgIndicator.SetActive(false);
         m_unreadMsgIndicator2.SetActive(false);
     }
     GUI.SetNextControlName("chatInputCom");
     m_chatString = GUI.TextField(m_chatRect, m_chatString, 100);
     if (Event.current.type != EventType.KeyUp)
     {
         return;
     }
     if (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter)
     {
         m_chatString = m_chatString.Replace("\\", string.Empty);
         if (m_chatString.Length > 0)
         {
             if (!IsSpam(m_chatString))
             {
                 if (null != m_client)
                 {
                     m_client.SendChatMsg(m_chatString, false);
                 }
                 else
                 {
                     AddString(m_chatString);
                 }
             }
             else
             {
                 AddString("System§ " + LNG.Get("ANTI_SPAM_CHAT"));
             }
             m_chatString = string.Empty;
         }
         else
         {
             GUI.FocusControl((!("chatInputCom" == GUI.GetNameOfFocusedControl())) ? "chatInputCom" : string.Empty);
         }
         Event.current.Use();
     }
     if (Event.current.keyCode == KeyCode.Escape)
     {
         GUI.FocusControl(string.Empty);
         m_chatString = string.Empty;
         Event.current.Use();
     }
 }
Пример #2
0
    private void Update()
    {
        if (null != m_client)
        {
            m_barHealth.localScale = new Vector3(m_client.GetHealth() * 0.01f * m_startScale.x, m_startScale.y, m_startScale.z);
            m_barEnergy.localScale = new Vector3(m_client.GetEnergy() * 0.01f * m_startScale.x, m_startScale.y, m_startScale.z);
        }
        bool flag = !m_inventory.activeSelf && !m_comGui.IsActive();

        if (flag != m_active)
        {
            m_active = flag;
            for (int i = 0; i < base.transform.childCount; i++)
            {
                Transform child = base.transform.GetChild(i);
                if (null != child)
                {
                    child.gameObject.SetActive(m_active);
                }
            }
        }
        int num = (!(null != m_client)) ? m_debugCondition : m_client.GetCondition();

        if (m_condition != num)
        {
            m_condition = num;
            UpdateConditions();
        }
    }
Пример #3
0
    private void Update()
    {
        if (Input.GetButtonDown("Exit") || Input.GetButtonDown("Communicator") || Input.GetButtonDown("Map") || Input.GetButtonDown("Help") || Input.GetButtonDown("Global Chat") || Input.GetButtonDown("Crafting"))
        {
            m_guiSteamInventory.SetActive(false);
            m_guiBig.SetActive(false);
            m_guiItemInfo.SetActive(false);
        }
        else if (Input.GetButtonDown("Inventory"))
        {
            m_guiSteamInventory.SetActive(false);
            m_guiBig.SetActive(!m_guiBig.activeSelf);
            m_guiItemInfo.SetActive(false);
        }
        if (m_hideInfoTime > 0f && Time.time > m_hideInfoTime)
        {
            m_guiItemInfo.SetActive(false);
            m_hideInfoTime = 0f;
        }
        if (IsShopActive() != m_guiShopInfo.activeSelf)
        {
            m_guiShopInfo.SetActive(IsShopActive());
        }
        bool flag = !(null != m_client) || m_client.IsTutorialActive();

        if (m_guiHintBuilding.activeSelf != flag)
        {
            m_guiHintBuilding.SetActive(flag);
        }
        if (null != m_client)
        {
            m_guiGold.text = m_client.GetGoldCount().ToString();
        }
        m_quitGameGui.m_openWithEsc = (!m_communicator.IsActive() && !m_guiBig.activeSelf);
    }
Пример #4
0
 public bool IsAttacking()
 {
     return(!m_inventory.IsVisible() && !m_communicator.IsActive() && (m_stopAttackingTime > Time.time || Input.GetButton("Attack")));
 }