Exemple #1
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;
            }
        }
    }
Exemple #2
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;
        }
    }