示例#1
0
            override public void OnUpdate()
            {
                if (View.detectMouseInWnd())
                {
                    m_HideTime = Time.time;
                }

                // 时间超过3s,隐藏外框
                if (m_HideTime > 0f && m_HideTime + 3f <= Time.time)
                {
                    View.SetHide(true);
                    m_HideTime = 0f;
                }

                // 输入框激活状态是否变化
                if (View.m_isInputFieldFocus != View.inputField.isFocused)
                {
                    if (View.m_isInputFieldFocus)
                    {
                        m_HideTime = Time.time;
                    }
                    else
                    {
                        View.SetHide(false);
                    }

                    View.m_isInputFieldFocus = View.inputField.isFocused;
                    InputManager.Available   = !View.m_isInputFieldFocus;
                    ImeManager.ActiveIme(View.m_isInputFieldFocus);
                }
            }
示例#2
0
            public override void OnUpdate()
            {
                // 拖拽状态,不处理
                if (View.resizer.IsDraging)
                {
                    return;
                }

                // 最小化状态,不处理
                if (View.m_isMin)
                {
                    return;
                }

                // 输入框激活状态是否变化
                if (View.m_isInputFieldFocus != View.inputField.isFocused)
                {
                    View.m_isInputFieldFocus = View.inputField.isFocused;
                    InputManager.Available   = !View.m_isInputFieldFocus;
                    ImeManager.ActiveIme(View.m_isInputFieldFocus);
                }

                //检测鼠标是否在聊天窗内
                bool isMouseInWnd = View.detectMouseInWnd();

                if (m_isActive) // 激活状态
                {
                    if (isMouseInWnd || View.inputField.isFocused)
                    {
                        // 取消3s后切换为非激活状态
                        m_PlayUnActiveTime = 0f;
                    }
                    else
                    {
                        // 开始3s后切换为非激活状态
                        if (m_PlayUnActiveTime < float.Epsilon)
                        {
                            m_PlayUnActiveTime = Time.time;
                        }
                    }

                    // 3s后切换为非激活状态
                    if (m_PlayUnActiveTime > 0f && Time.time - m_PlayUnActiveTime > 3f)
                    {
                        m_PlayUnActiveTime = 0;

                        // 切换聊天框为非激活状态
                        setUnActiveState();
                    }
                }
                else    // 非激活状态
                {
                    if (isMouseInWnd || View.inputField.isFocused)
                    {
                        // 切换聊天框为激活状态
                        SetActiveState();
                    }
                }
            }
    public void Awake()
    {
        ImeManager imeManager = MonoInstance.GetComponent <ImeManager>();

        if (imeManager == null)
        {
            imeManager = MonoInstance.AddComponent <ImeManager>();
        }
    }
示例#4
0
 public override void OnUpdate()
 {
     // 输入框激活状态是否变化
     if (View.m_isInputFieldFocus != View.inputField.isFocused)
     {
         View.m_isInputFieldFocus = View.inputField.isFocused;
         InputManager.Available   = !View.m_isInputFieldFocus;
         ImeManager.ActiveIme(View.m_isInputFieldFocus);
     }
 }
示例#5
0
    public void Update()
    {
        if (null != m_InputField && bIsFocused != m_InputField.isFocused)
        {
            bIsFocused = m_InputField.isFocused;
            //GameLogicConfigApi.ActiveIME(bIsFocused);
            InputManager.Available = !bIsFocused;

            if (m_InputField.inputType != InputField.InputType.Password &&
                !ForbidIME)
            {
                ImeManager.ActiveIme(bIsFocused);
            }
        }
    }
示例#6
0
        public void OnImeChanged()
        {
            int index = imeDropdown.value;

            ImeManager.SwitchIme(imeDropdown.options[index].text);
            if (imeDropdown.value != 0)
            {
                chineseIcon.gameObject.SetActive(true);
                enIcon.gameObject.SetActive(false);
            }
            else
            {
                chineseIcon.gameObject.SetActive(false);
                enIcon.gameObject.SetActive(true);
            }
            inputField.Select();
            ImeManager.EnableIme = true;
        }
示例#7
0
        public override bool Init(IUIWnd wnd)
        {
            base.Init(wnd);

            // 从脚本配置中获取各个频道名字,缓存起来,与频道宏定义做个映射,方便读取
            string[] channelName = { "SystemChannelName",
                                     "WorldChannelName",
                                     "MatchroomChannelName",
                                     "TeammateChannelName",
                                     "WarSceneChannelName",
                                     "PrivateChannelName",
                                     "KinChannelName",
                                     "ClanChannelName",
                                     "NearbyChannelName",
                                     "ZoneChannelName",
                                     "CampChannelName", };
            for (EMChatChannelType type = EMChatChannelType.CHAT_CHANNEL_SYSTEM; type < EMChatChannelType.CHAT_CHANNEL_MAX; ++type)
            {
                m_dicChannnelName[type] = ULocalizationService.Instance.Get("UIView", "ChatBox", channelName[(int)type]);
            }



            canDrag = false;

            //如果游戏限制输入法,则初始化相关界面
            if (ImeManager.ForbidIme)
            {
                List <string> imeList = ImeManager.GetImeNameList();
                if (imeList != null)
                {
                    foreach (var temp in imeList)
                    {
                        imeDropdown.options.Add(new Dropdown.OptionData()
                        {
                            text = temp
                        });
                    }
                }
                imeDropdown.value = 0;
                chineseIcon.gameObject.SetActive(false);
                enIcon.gameObject.SetActive(true);
            }
            else//否则隐藏
            {
                imeDropdown.interactable = false;
                chineseIcon.gameObject.SetActive(false);
                enIcon.gameObject.SetActive(false);
            }

            inputField.onEndEdit.AddListener(delegate { OnEndEdit(); });

            resizer.SetWndView(this);

            minimumIcon.SetChatWndView(this);
            minimunCanvasGroup       = minimumIcon.GetComponent <CanvasGroup>();
            channelMaskItemPrefabRes = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, "UI/Prefabs/Chat/ChatChannelGroupItem");

            m_DiyChannelMask = ChatSettingConfig.Instance.GetChatSettingIntValue(ChatSettingIndex.DiyChannelMask);

            m_DiyChannelGroup.setWndView(this);
            m_DiyChannelGroup.Init();

            emoticonPanel.SetChatWndView(this);
            emoticonPanel.Init();
            emoticonBtn.onClick.AddListener(delegate { emoticonPanel.SwitchEmotionPanelActiveState(); });

            // 设置消息显示定时器
            TimerManager.SetTimer(this, (int)EChatTimer.EChatTimer_ShowChatMsg, 0.5f);
#if FUNCTION_AUTO_ADD_CHAT_OPEN
            TimerManager.SetTimer(this, (int)EChatTimer.EChatTimer_AddChatMsg, 1f);
#endif

            // 计算聊天框位置
            m_DownPos = GetTransform().anchoredPosition;
            m_UpPos   = new Vector3(m_DownPos.x, m_DownPos.y + 300, m_DownPos.z);

            // 初始化大小
            m_InitSize = new Vector2(GetTransform().sizeDelta.x, GetTransform().sizeDelta.y);


            m_isMin = false;

            inputField.onFocusChange.AddListener(OnFocus);

            fpsHintInitPosition = fpsSwitchHint.GetComponent <RectTransform>().anchoredPosition;


            m_PopupWndStatus = new Dictionary <int, bool>();

            m_fullWndStatus = new Dictionary <int, bool>();
            //m_ModalKey = 0;

            m_ChatBoxState = new ChatBoxBase(this);

            return(true);
        }