Пример #1
0
    // 选定头发颜色(回调函数)aa
    protected void onHairColorSelected(DragPanelIcon kDragPanelIcon)
    {
        if (kDragPanelIcon == null)
        {
            return;
        }

        // 头发颜色aa
        int iHairColor = kDragPanelIcon.m_IconId - 1;

        if (iHairColor < 0)
        {
            iHairColor = 0;
        }
        if (iHairColor > 7)
        {
            iHairColor = 7;
        }

        //
        mHairColor = iHairColor;

        // 更新预览角色aa
        if (mLoginChar != null)
        {
            mLoginChar.setHairColor(iHairColor);
        }
    }
Пример #2
0
    // 处理按下与松开消息aa
    void OnPress(bool isPressed)
    {
        if (!isPressed)
        {
            if (mIsDragging)
            {
                DragPanelIcon   kNearIcon = null;
                DragPanelIcon[] kIconList = this.transform.parent.GetComponentsInChildren <DragPanelIcon>();

                float   fMinDistance = 1000.0f;
                Vector4 kRange       = this.transform.parent.GetComponent <UIPanel>().clipRange;
                foreach (DragPanelIcon kIconItem in kIconList)
                {
                    float kPosition = kIconItem.gameObject.transform.localPosition.x;
                    float fDelta    = Mathf.Abs(kPosition - kRange.x);
                    if (fDelta < fMinDistance)
                    {
                        fMinDistance = fDelta;
                        kNearIcon    = kIconItem;
                    }
                }

                if (kNearIcon != null)
                {
                    sdDragPanel kDragPanel = this.gameObject.transform.parent.GetComponent <sdDragPanel>();
                    kDragPanel.onDragFinished += new sdDragPanel.OnDragFinished(kNearIcon.OnDragFinishNotify);                          //< 注册回调aa
                    kDragPanel.SetMove(kNearIcon.transform.localPosition.x);                                                            //< 要求面板移动到指定位置aa
                }

                mIsDragging = false;
            }
            else
            {
                if (this.gameObject.transform.localPosition.x == this.transform.parent.GetComponent <UIPanel>().clipRange.x)
                {
                    if (onDragFinished != null)                                 //< 已经在指定位置则立即回调aa
                    {
                        onDragFinished(this);
                    }
                }
                else
                {
                    sdDragPanel kDragPanel = this.gameObject.transform.parent.GetComponent <sdDragPanel>();
                    kDragPanel.onDragFinished += new sdDragPanel.OnDragFinished(this.OnDragFinishNotify);                       //< 注册回调aa
                    kDragPanel.SetMove(this.gameObject.transform.localPosition.x);                                              //< 要求面板移动到指定位置aa
                }
            }
        }
    }
Пример #3
0
    // 选定头发样式(回调函数)aa
    protected void onHairStyleSelected(DragPanelIcon kDragPanelIcon)
    {
        if (kDragPanelIcon == null)
        {
            return;
        }

        // 头发样式aa
        int iHairStyle = kDragPanelIcon.m_IconId - 1;

        if (iHairStyle < 0)
        {
            iHairStyle = 0;
        }
        if (iHairStyle > 7)
        {
            iHairStyle = 7;
        }

        //
        mHairStyle = iHairStyle;

        // 更新预览角色aa
        int iGender = 0;

        if (mLoginChar != null)
        {
            mLoginChar.setHairStyle(mHairStyle);
            iGender = mLoginChar.Gender;
        }

        // 更新头发颜色图标aa
        foreach (GameObject kGameObject in m_HairColorObjectArray)
        {
            DragPanelHairIcon kIcon = kGameObject.GetComponent <DragPanelHairIcon>();
            if (kIcon)
            {
                int iIndex     = kIcon.m_IconId;                //< 1,2,3,4,5,6,7,8
                int iHairColor = iIndex - 1;                    //< 0,1,2,3,4,5,6,7

                kIcon.Gender    = iGender;
                kIcon.HairStyle = iHairStyle;
                kIcon.HairColor = iHairColor;
            }
        }
    }
Пример #4
0
    void Awake()
    {
        if (m_CreateRoleRaceWndObject)
        {
            mCreateRoleRace = m_CreateRoleRaceWndObject.GetComponent <CreateRoleRace>();
        }

        mSpinObject = this.gameObject.GetComponent <SpinObject>();

        foreach (GameObject kGameObject in m_HairStyleObjectArray)
        {
            if (kGameObject == null)
            {
                continue;
            }

            DragPanelIcon kIcon = kGameObject.GetComponent <DragPanelIcon>();
            if (kIcon != null)
            {
                kIcon.onDragFinished += onHairStyleSelected;
            }
        }

        foreach (GameObject kGameObject in m_HairColorObjectArray)
        {
            if (kGameObject == null)
            {
                continue;
            }

            DragPanelIcon kIcon = kGameObject.GetComponent <DragPanelIcon>();
            if (kIcon != null)
            {
                kIcon.onDragFinished += onHairColorSelected;
            }
        }

//		LoadHairAtlas(0, 0, 0);
//		LoadHairAtlas(0, 1, 0);
//		LoadHairAtlas(0, 2, 0);
//		LoadHairAtlas(0, 3, 0);
//		LoadHairAtlas(0, 4, 0);
//		LoadHairAtlas(0, 5, 0);
//		LoadHairAtlas(0, 6, 0);
//		LoadHairAtlas(0, 7, 0);
//		LoadHairAtlas(1, 0, 0);
//		LoadHairAtlas(1, 1, 0);
//		LoadHairAtlas(1, 2, 0);
//		LoadHairAtlas(1, 3, 0);
//		LoadHairAtlas(1, 4, 0);
//		LoadHairAtlas(1, 5, 0);
//		LoadHairAtlas(1, 6, 0);
//		LoadHairAtlas(1, 7, 0);

        // 根据分辨率调整显示...
        GameObject obj = GameObject.Find("sp_link1");

        if (obj != null)
        {
            float r = 1.777f / ((float)Screen.width / (float)Screen.height) - 1.0f;
            float y = (1280.0f / (float)Screen.width * (float)Screen.height - 720.0f) / 2.0f + 1030.0f; // 16:9下的y为1030,4:3下的y为1150
            obj.GetComponent <TweenPosition>().from.y = y;
            obj.GetComponent <TweenPosition>().to.y   = y - 620.0f - 300.0f * r;                        // 对4:3屏幕,r=0.33,锁链长度一共会增长100
        }
        obj = GameObject.Find("sp_link2");
        if (obj != null)
        {
            float r = 1.777f / ((float)Screen.width / (float)Screen.height) - 1.0f;
            float y = (1280.0f / (float)Screen.width * (float)Screen.height - 720.0f) / 2.0f + 980.0f;  // 16:9下的y为980,4:3下的y为1100
            obj.GetComponent <TweenPosition>().from.y = y;
            obj.GetComponent <TweenPosition>().to.y   = y - 570.0f - 300.0f * r;                        // 对4:3屏幕,r=0.33,锁链长度一共会增长100
        }
    }
Пример #5
0
    // 创建种族,展示裸装aa
    protected void CreateRace(int iRace)
    {
        mSelectedRace = iRace;

        //
        if (iRace == 0)
        {
            mJob    = (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior;
            mGender = 0;
        }
        else if (iRace == 1)
        {
            mJob    = (int)HeaderProto.ERoleJob.ROLE_JOB_Magic;
            mGender = 1;
        }
        else if (iRace == 2)
        {
            mJob    = (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue;
            mGender = 0;
        }
        else if (iRace == 3)
        {
            mJob    = (int)HeaderProto.ERoleJob.ROLE_JOB_Minister;
            mGender = 1;
        }
        else
        {
            return;
        }

        // 设置头发样式图标aa
        foreach (GameObject kGameObject in m_HairStyleObjectArray)
        {
            DragPanelHairIcon kIcon = kGameObject.GetComponent <DragPanelHairIcon>();
            if (kIcon)
            {
                int iIndex     = kIcon.m_IconId;                //< 1,2,3,4,5,6,7,8
                int iHairStyle = iIndex - 1;                    //< 0,1,2,3,4,5,6,7

                kIcon.Gender    = mGender;
                kIcon.HairStyle = iHairStyle;
                kIcon.HairColor = 0;
            }
        }

        // 更新头发颜色图标aa
        foreach (GameObject kGameObject in m_HairColorObjectArray)
        {
            DragPanelHairIcon kIcon = kGameObject.GetComponent <DragPanelHairIcon>();
            if (kIcon)
            {
                int iIndex     = kIcon.m_IconId;                //< 1,2,3,4,5,6,7,8
                int iHairColor = iIndex - 1;                    //< 0,1,2,3,4,5,6,7

                kIcon.Gender    = mGender;
                kIcon.HairColor = iHairColor;
            }
        }

        // 重置头发样式UIaa
        if (m_HairStyleObject)
        {
            mHairStyle = (int)(Random.value * 100.0f) % 8;              //< 随机头发样式aa

            DragPanelIcon kSelIcon = null;
            foreach (GameObject kGameObject in m_HairStyleObjectArray)
            {
                if (kGameObject == null)
                {
                    continue;
                }

                DragPanelIcon kIcon = kGameObject.GetComponent <DragPanelIcon>();
                if (kIcon != null && (kIcon.m_IconId == mHairStyle + 1))
                {
                    kSelIcon = kIcon;
                    break;
                }
            }

            if (kSelIcon != null)
            {
                kSelIcon.Select();
            }
        }

        // 重置头发颜色UIaa
        if (m_HairColorObject)
        {
            mHairColor = (int)(Random.value * 100.0f) % 8;              //< 随机头发颜色aa

            DragPanelIcon kSelIcon = null;
            foreach (GameObject kGameObject in m_HairColorObjectArray)
            {
                if (kGameObject == null)
                {
                    continue;
                }

                DragPanelIcon kIcon = kGameObject.GetComponent <DragPanelIcon>();
                if (kIcon != null && (kIcon.m_IconId == mHairColor + 1))
                {
                    kSelIcon = kIcon;
                    break;
                }
            }

            if (kSelIcon != null)
            {
                kSelIcon.Select();
            }
        }

        // 删除之前角色aa
        if (mLoginCharObject != null)
        {
            if (mSpinObject)
            {
                mSpinObject.m_Target = null;
            }

            GameObject.Destroy(mLoginCharObject);

            mLoginChar       = null;
            mLoginCharObject = null;
        }

        // 创建角色aa
        GameObject obj = GameObject.Find("city_construct_halidom02");

        mLoginCharObject                         = new GameObject();
        mLoginCharObject.name                    = "@CreateChar2";
        mLoginCharObject.transform.parent        = GameObject.Find("SelectSceneWnd").transform;
        mLoginCharObject.transform.localPosition = new Vector3(obj.transform.localPosition.x, -0.76f, obj.transform.localPosition.z);
        mLoginCharObject.transform.localRotation = Quaternion.Euler(0.0f, 158.1343f, 0.0f);
        mLoginCharObject.transform.localScale    = new Vector3(0.9f, 0.9f, 0.9f);
        mLoginCharObject.AddComponent <AudioSource>();
        //
        sdGameActorCreateInfo kInfo = new sdGameActorCreateInfo();

        kInfo.mGender    = (byte)mGender;
        kInfo.mHairStyle = (byte)mHairStyle;
        kInfo.mSkinColor = (byte)mHairColor;
        kInfo.mBaseJob   = (byte)mJob;
        kInfo.mJob       = (byte)mJob;

        mLoginChar = mLoginCharObject.AddComponent <sdLoginChar>();
        mLoginChar.SetVisiable_WhenLoading(false);
        mLoginChar.init(kInfo);

        // 新手套装,不显示头盔.
        uint [] uiEquipment      = null;
        uint    uiEquipmentCount = 0;

        if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior)
        {
            uiEquipment = new uint[6] {
                1000, 1001, 1003, 1004, 1005, 1006
            };
            uiEquipmentCount = 6;
        }
        else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Magic)
        {
            uiEquipment = new uint[5] {
                4000, 4003, 4004, 4005, 4006
            };
            uiEquipmentCount = 5;
        }
        else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue)
        {
            uiEquipment = new uint[5] {
                8000, 8003, 8004, 8005, 8006
            };
            uiEquipmentCount = 5;
        }
        else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Minister)
        {
            uiEquipment = new uint[6] {
                6000, 6001, 6003, 6004, 6005, 6006
            };
            uiEquipmentCount = 6;
        }
        mLoginChar.updateAvatar(uiEquipment, uiEquipmentCount);
        mLoginChar.RequestEnd();
        // 设置给旋转脚本aa
        if (mSpinObject)
        {
            mSpinObject.m_Target = mLoginChar;
        }
    }