Пример #1
0
    void Awake()
    {
        m_instance    = this;
        m_myTransform = transform;
        FillFullNameData(m_myTransform);

        Initialize();
        PreLoadResource();

        m_myTransform.Find("CommunityUIBottom").GetComponentsInChildren <UIAnchor>(true)[0].uiCamera = GameObject.Find("Camera").GetComponentsInChildren <Camera>(true)[0];

        m_goFaceList   = m_myTransform.Find(m_widgetToFullName["CommunityUIFaceList"]).gameObject;
        m_goFriendList = m_myTransform.Find(m_widgetToFullName["CommunityUIFriendList"]).gameObject;

        //m_inputText = m_myTransform.FindChild(m_widgetToFullName["CommunityUIPrivateInput"]).GetComponentsInChildren<MogoInput>(true)[0];
        m_inputText = m_myTransform.Find(m_widgetToFullName["CommunityUIPrivateInput"]).gameObject.AddComponent <MogoInput>();
        //m_inputText.text = "";

        m_inputText.label = m_myTransform.Find(m_widgetToFullName["CommunityUIPrivateInputText"]).GetComponentsInChildren <UILabel>(true)[0];

        m_transFaceStartPos = m_myTransform.Find(m_widgetToFullName["CommunityUIFaceTopLeft"]);
        m_transFaceEndPos   = m_myTransform.Find(m_widgetToFullName["CommunityUIFaceBottomRight"]);

        m_goFriendButton = m_myTransform.Find(m_widgetToFullName["CommunityUIFriendButton"]).gameObject;
        m_goPrivateInput = m_myTransform.Find(m_widgetToFullName["CommunityUIPrivateInput"]).gameObject;

        m_goAddFriendTip      = m_myTransform.Find(m_widgetToFullName["CommunityUIAddFriendTip"]).gameObject;
        m_lblAddFriendTipName = m_myTransform.Find(m_widgetToFullName["CommunityUIAddFriendTipName"]).GetComponentsInChildren <UILabel>(true)[0];

        m_goFriendGridList        = m_myTransform.Find(m_widgetToFullName["CommunityUIFriendGridList"]).gameObject;
        m_camFriendGirdListCamera = m_myTransform.Find(m_widgetToFullName["CommunityUIFriendGridCamera"]).GetComponentsInChildren <Camera>(true)[0];
        m_camWorldChannelCamera   = m_myTransform.Find(m_widgetToFullName["WorldCannelDialogCamera"]).GetComponentsInChildren <Camera>(true)[0];
        m_camTongChannelCamera    = m_myTransform.Find(m_widgetToFullName["TongCannelDialogCamera"]).GetComponentsInChildren <Camera>(true)[0];
        m_camPrivateChannelCamera = m_myTransform.Find(m_widgetToFullName["PrivateCannelDialogCamera"]).GetComponentsInChildren <Camera>(true)[0];
        m_camInputTextCamera      = m_myTransform.Find(m_widgetToFullName["CommunityUIPrivateInputListCamera"]).GetComponentsInChildren <Camera>(true)[0];

        m_camFriendGirdListCamera.GetComponentsInChildren <UIViewport>(true)[0].sourceCamera = GameObject.Find("Camera").GetComponentsInChildren <Camera>(true)[0];
        m_camWorldChannelCamera.GetComponentsInChildren <UIViewport>(true)[0].sourceCamera   = GameObject.Find("Camera").GetComponentsInChildren <Camera>(true)[0];
        m_camTongChannelCamera.GetComponentsInChildren <UIViewport>(true)[0].sourceCamera    = GameObject.Find("Camera").GetComponentsInChildren <Camera>(true)[0];
        m_camPrivateChannelCamera.GetComponentsInChildren <UIViewport>(true)[0].sourceCamera = GameObject.Find("Camera").GetComponentsInChildren <Camera>(true)[0];
        m_camInputTextCamera.GetComponentsInChildren <UIViewport>(true)[0].sourceCamera      = GameObject.Find("Camera").GetComponentsInChildren <Camera>(true)[0];

        m_equipDetailNeedLevel = m_myTransform.Find(m_widgetToFullName["PackageEquipInfoDetailNeedLevelNum"]).GetComponentsInChildren <UILabel>(true)[0];
        m_equipDetailGrowLevel = m_myTransform.Find(m_widgetToFullName["PackageEquipInfoDetailGrowLevelNum"]).GetComponentsInChildren <UILabel>(true)[0];
        m_equipDetailNeedJob   = m_myTransform.Find(m_widgetToFullName["PackageEquipInfoDetailNeedJobType"]).GetComponentsInChildren <UILabel>(true)[0];
        m_equipDetailExtra     = m_myTransform.Find(m_widgetToFullName["PackageEquipInfoDetailExtraText"]).GetComponentsInChildren <UILabel>(true)[0];
        m_equipDetailImageFG   = m_myTransform.Find(m_widgetToFullName["PackageEquipInfoDetailImageFG"]).GetComponentsInChildren <UISlicedSprite>(true)[0];

        m_goEquipmentDetailInfo = m_myTransform.Find(m_widgetToFullName["PacakgeEquipNewInfo"]).gameObject;

        for (int i = 0; i < 4; ++i)
        {
            m_arrNewDiamondHoleIcon[i] = m_myTransform.Find(m_widgetToFullName["PackageEquipInfoDiamonHole" + (i + 9) + "FG"]).GetComponentsInChildren <UISlicedSprite>(true)[0].gameObject;
        }

        AddFaceIconToList();
    }
Пример #2
0
    void Awake()
    {
        gameObject.SetActive(false);

        Initialize();

        m_myTransform = transform;
        FillFullNameData(m_myTransform);

        m_inputText = m_myTransform.FindChild(m_widgetToFullName["ChatUIInput"]).GetComponentsInChildren <MogoInput>(true)[0];
    }
Пример #3
0
    /// <summary>
    /// Update the text and the label by grabbing it from the iOS/Android keyboard.
    /// </summary>

    void Update()
    {
        UpdateLabel();

        if (mKeyboard != null)
        {
            string text = mKeyboard.text;

            if (mText != text)
            {
                mText = "";

                for (int i = 0; i < text.Length; ++i)
                {
                    char ch = text[i];
                    if (validator != null)
                    {
                        ch = validator(mText, ch);
                    }
                    if (ch != 0)
                    {
                        mText += ch;
                    }
                }

                if (mText != text)
                {
                    mKeyboard.text = mText;
                }
                //UpdateLabel();
            }

            if (mKeyboard.done)
            {
                mKeyboard = null;
                current   = this;
                if (onSubmit != null)
                {
                    onSubmit(mText);
                }
                if (eventReceiver == null)
                {
                    eventReceiver = gameObject;
                }
                eventReceiver.SendMessage(functionName, mText, SendMessageOptions.DontRequireReceiver);
                current  = null;
                selected = false;
            }
        }
    }
Пример #4
0
    /// <summary>
    /// Input event, sent by UICamera.
    /// </summary>

    void OnInput(string input)
    {
        if (mDoInit)
        {
            Init();
        }

        if (selected && enabled && NGUITools.GetActive(gameObject))
        {
            // Mobile devices handle input in Update()
            if (Application.platform == RuntimePlatform.Android)
            {
                return;
            }
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                return;
            }


            for (int i = 0, imax = input.Length; i < imax; ++i)
            {
                char c = input[i];

                if (c == '\b')
                {
                    // Backspace
                    if (mText.Length > 0)
                    {
                        if (mText.Length > 2 && mText.Substring(mText.Length - 3, 3) == "[-]")  //Maifeo
                        {
                            int tmp = 4;

                            while (tmp < mText.Length)
                            {
                                if (mText[mText.Length - tmp] == ']' && tmp + 7 <= mText.Length)
                                {
                                    if (mText[mText.Length - (tmp + 7)] == '[')
                                    {
                                        mText = mText.Substring(0, mText.Length - (tmp + 7) - 14);
                                        break;
                                    }
                                }

                                ++tmp;
                            }
                        }                                                                       //MaiFeo
                        else if (mText.Length > 0 && mText[mText.Length - 1] == '}')
                        {
                            int tmp = 2;

                            while (tmp < mText.Length)
                            {
                                if (mText[mText.Length - tmp] == ':' && tmp + 1 <= mText.Length)
                                {
                                    if (mText[mText.Length - (tmp + 1)] == '{')
                                    {
                                        mText = mText.Substring(0, mText.Length - (tmp + 1) - 10);

                                        AssetCacheMgr.ReleaseInstance(mFaceList[mFaceList.Count - 1]);
                                        mFaceList.Remove(mFaceList[mFaceList.Count - 1]);
                                        break;
                                    }
                                }

                                ++tmp;
                            }
                            //mText = mText.Substring(0, mText.Length - 14);
                        }
                        else
                        {
                            mText = mText.Substring(0, mText.Length - 1);
                        }
                        SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                    }
                }
                else if (c == '\r' || c == '\n')
                {
                    if (UICamera.current.submitKey0 == KeyCode.Return || UICamera.current.submitKey1 == KeyCode.Return)
                    {
                        // Not multi-line input, or control isn't held
                        if (!label.multiLine || (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl)))
                        {
                            // Enter
                            current = this;
                            if (onSubmit != null)
                            {
                                onSubmit(mText);
                            }
                            if (eventReceiver == null)
                            {
                                eventReceiver = gameObject;
                            }
                            eventReceiver.SendMessage(functionName, mText, SendMessageOptions.DontRequireReceiver);
                            current  = null;
                            selected = false;
                            return;
                        }
                    }

                    // If we have an input validator, validate the input first
                    if (validator != null)
                    {
                        c = validator(mText, c);
                    }

                    // If the input is invalid, skip it
                    if (c == 0)
                    {
                        continue;
                    }

                    // Append the character
                    if (c == '\n' || c == '\r')
                    {
                        if (label.multiLine)
                        {
                            mText += "\n";
                        }
                    }
                    else
                    {
                        mText += c;
                    }

                    // Notify the listeners
                    SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                }
                else if (c >= ' ')
                {
                    // If we have an input validator, validate the input first
                    if (validator != null)
                    {
                        c = validator(mText, c);
                    }

                    // If the input is invalid, skip it
                    if (c == 0)
                    {
                        continue;
                    }

                    // Append the character and notify the "input changed" listeners.
                    mText += c;
                    SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                }
            }

            // Ensure that we don't exceed the maximum length
            UpdateLabel();
        }
    }
Пример #5
0
    void Awake()
    {

        gameObject.SetActive(false);

        Initialize();

        m_myTransform = transform;
        FillFullNameData(m_myTransform);

        m_inputText = m_myTransform.FindChild(m_widgetToFullName["ChatUIInput"]).GetComponentsInChildren<MogoInput>(true)[0];
    }
Пример #6
0
    void Awake()
    {
        m_instance = this;
        m_myTransform = transform;
        FillFullNameData(m_myTransform);        

        Initialize();
        PreLoadResource();

        m_myTransform.FindChild("CommunityUIBottom").GetComponentsInChildren<UIAnchor>(true)[0].uiCamera = GameObject.Find("Camera").GetComponentsInChildren<Camera>(true)[0];

        m_goFaceList = m_myTransform.FindChild(m_widgetToFullName["CommunityUIFaceList"]).gameObject;
        m_goFriendList = m_myTransform.FindChild(m_widgetToFullName["CommunityUIFriendList"]).gameObject;

        //m_inputText = m_myTransform.FindChild(m_widgetToFullName["CommunityUIPrivateInput"]).GetComponentsInChildren<MogoInput>(true)[0];
        m_inputText = m_myTransform.FindChild(m_widgetToFullName["CommunityUIPrivateInput"]).gameObject.AddComponent<MogoInput>();
        //m_inputText.text = "";

        m_inputText.label = m_myTransform.FindChild(m_widgetToFullName["CommunityUIPrivateInputText"]).GetComponentsInChildren<UILabel>(true)[0];

        m_transFaceStartPos = m_myTransform.FindChild(m_widgetToFullName["CommunityUIFaceTopLeft"]);
        m_transFaceEndPos = m_myTransform.FindChild(m_widgetToFullName["CommunityUIFaceBottomRight"]);

        m_goFriendButton = m_myTransform.FindChild(m_widgetToFullName["CommunityUIFriendButton"]).gameObject;
        m_goPrivateInput = m_myTransform.FindChild(m_widgetToFullName["CommunityUIPrivateInput"]).gameObject;

        m_goAddFriendTip = m_myTransform.FindChild(m_widgetToFullName["CommunityUIAddFriendTip"]).gameObject;
        m_lblAddFriendTipName = m_myTransform.FindChild(m_widgetToFullName["CommunityUIAddFriendTipName"]).GetComponentsInChildren<UILabel>(true)[0];

        m_goFriendGridList = m_myTransform.FindChild(m_widgetToFullName["CommunityUIFriendGridList"]).gameObject;
        m_camFriendGirdListCamera = m_myTransform.FindChild(m_widgetToFullName["CommunityUIFriendGridCamera"]).GetComponentsInChildren<Camera>(true)[0];
        m_camWorldChannelCamera = m_myTransform.FindChild(m_widgetToFullName["WorldCannelDialogCamera"]).GetComponentsInChildren<Camera>(true)[0];
        m_camTongChannelCamera = m_myTransform.FindChild(m_widgetToFullName["TongCannelDialogCamera"]).GetComponentsInChildren<Camera>(true)[0];
        m_camPrivateChannelCamera = m_myTransform.FindChild(m_widgetToFullName["PrivateCannelDialogCamera"]).GetComponentsInChildren<Camera>(true)[0];
        m_camInputTextCamera = m_myTransform.FindChild(m_widgetToFullName["CommunityUIPrivateInputListCamera"]).GetComponentsInChildren<Camera>(true)[0];

        m_camFriendGirdListCamera.GetComponentsInChildren<UIViewport>(true)[0].sourceCamera = GameObject.Find("Camera").GetComponentsInChildren<Camera>(true)[0];
        m_camWorldChannelCamera.GetComponentsInChildren<UIViewport>(true)[0].sourceCamera = GameObject.Find("Camera").GetComponentsInChildren<Camera>(true)[0];
        m_camTongChannelCamera.GetComponentsInChildren<UIViewport>(true)[0].sourceCamera = GameObject.Find("Camera").GetComponentsInChildren<Camera>(true)[0];
        m_camPrivateChannelCamera.GetComponentsInChildren<UIViewport>(true)[0].sourceCamera = GameObject.Find("Camera").GetComponentsInChildren<Camera>(true)[0];
        m_camInputTextCamera.GetComponentsInChildren<UIViewport>(true)[0].sourceCamera = GameObject.Find("Camera").GetComponentsInChildren<Camera>(true)[0];

        m_equipDetailNeedLevel = m_myTransform.FindChild(m_widgetToFullName["PackageEquipInfoDetailNeedLevelNum"]).GetComponentsInChildren<UILabel>(true)[0];
        m_equipDetailGrowLevel = m_myTransform.FindChild(m_widgetToFullName["PackageEquipInfoDetailGrowLevelNum"]).GetComponentsInChildren<UILabel>(true)[0];
        m_equipDetailNeedJob = m_myTransform.FindChild(m_widgetToFullName["PackageEquipInfoDetailNeedJobType"]).GetComponentsInChildren<UILabel>(true)[0];
        m_equipDetailExtra = m_myTransform.FindChild(m_widgetToFullName["PackageEquipInfoDetailExtraText"]).GetComponentsInChildren<UILabel>(true)[0];
        m_equipDetailImageFG = m_myTransform.FindChild(m_widgetToFullName["PackageEquipInfoDetailImageFG"]).GetComponentsInChildren<UISlicedSprite>(true)[0];

        m_goEquipmentDetailInfo = m_myTransform.FindChild(m_widgetToFullName["PacakgeEquipNewInfo"]).gameObject;

        for (int i = 0; i < 4; ++i)
        {
            m_arrNewDiamondHoleIcon[i] = m_myTransform.FindChild(m_widgetToFullName["PackageEquipInfoDiamonHole" + (i + 9) + "FG"]).GetComponentsInChildren<UISlicedSprite>(true)[0].gameObject;
        }

        AddFaceIconToList();
    }