示例#1
0
    private IEnumerator DoLoadHelm(EquipItemTable.EquipItemData data)
    {
        EquipModelTable.Data model_data = data.GetModelData(sexID);
        LoadObject           lo_head    = loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.PLAYER_HEAD, ResourceName.GetPlayerHead(data.GetModelID(sexID)));
        LoadObject           lo_face    = null;

        if (model_data.needFace)
        {
            lo_face = loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.PLAYER_FACE, ResourceName.GetPlayerFace(faceModelID));
        }
        yield return((object)loadingQueue.Wait());

        Transform head = lo_head.Realizes(_transform, _transform.get_gameObject().get_layer());

        head.set_localPosition(Vector3.get_zero());
        head.set_localRotation(Quaternion.get_identity());
        PlayerLoader.SetEquipColor(head, NGUIMath.IntToColor(data.modelColor0));
        nodeMain = head;
        yield return((object)this.StartCoroutine(InitRoopEffect(loadingQueue, head, SHADER_TYPE.NORMAL)));

        if (lo_face != null)
        {
            Transform face = lo_face.Realizes(head, _transform.get_gameObject().get_layer());
            _SetMannequinMaterial(face);
        }
        displayInfo = MonoBehaviourSingleton <GlobalSettingsManager> .I.uiModelRendering.helmDisplayInfo;
        OnLoadFinished();
    }
示例#2
0
    private IEnumerator DoLoadFullBody(EquipItemTable.EquipItemData data)
    {
        EquipModelTable.Data model_data = data.GetModelData(sexID);
        bool       is_bdy          = data.type == EQUIPMENT_TYPE.ARMOR || data.type == EQUIPMENT_TYPE.VISUAL_ARMOR;
        bool       is_arm          = data.type == EQUIPMENT_TYPE.ARM || data.type == EQUIPMENT_TYPE.VISUAL_ARM;
        bool       is_leg          = data.type == EQUIPMENT_TYPE.LEG || data.type == EQUIPMENT_TYPE.VISUAL_LEG;
        int        sex_id          = sexID;
        int        face_id         = faceModelID;
        int        hair_id         = -1;
        int        body_id         = (!is_bdy) ? MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.mannequinBodyIDs[sex_id] : data.GetModelID(sex_id);
        int        arm_id          = (!is_arm) ? (-1) : data.GetModelID(sex_id);
        int        leg_id          = (!is_leg) ? MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.mannequinLegIDs[sex_id] : data.GetModelID(sex_id);
        Color      mannequin_color = MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.mannequinSkinColor;
        Color      skin_color      = mannequin_color;
        Color      hair_color      = mannequin_color;
        Color      equip_color     = NGUIMath.IntToColor(data.modelColor0);
        LoadObject lo_face         = (!model_data.needFace) ? null : loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.PLAYER_FACE, ResourceName.GetPlayerFace(face_id));
        LoadObject lo_hair         = (hair_id <= -1) ? null : loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.PLAYER_HEAD, ResourceName.GetPlayerHead(hair_id));
        LoadObject lo_body         = loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.PLAYER_BDY, ResourceName.GetPlayerBody(body_id));
        LoadObject lo_arm          = (!model_data.needArm || arm_id <= -1) ? null : loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.PLAYER_ARM, ResourceName.GetPlayerArm(arm_id));
        LoadObject lo_leg          = (!model_data.needLeg || leg_id <= -1) ? null : loadingQueue.LoadAndInstantiate(RESOURCE_CATEGORY.PLAYER_LEG, ResourceName.GetPlayerLeg(leg_id));

        yield return((object)loadingQueue.Wait());

        Transform body = lo_body.Realizes(_transform, _transform.get_gameObject().get_layer());

        body.set_localPosition(Vector3.get_zero());
        body.set_localRotation(Quaternion.get_identity());
        PlayerLoader.SetSkinAndEquipColor(body, skin_color, (!is_bdy) ? mannequin_color : equip_color, 0f);
        if (!is_bdy)
        {
            _SetMannequinMaterial(body);
        }
        else
        {
            yield return((object)this.StartCoroutine(InitRoopEffect(loadingQueue, body, SHADER_TYPE.NORMAL)));
        }
        nodeMain = body;
        SkinnedMeshRenderer body_skin  = body.GetComponentInChildren <SkinnedMeshRenderer>();
        Transform           head_node  = Utility.Find(body, "Head");
        Transform           L_Upperarm = Utility.Find(body, "L_Upperarm");
        Transform           R_Upperarm = Utility.Find(body, "R_Upperarm");

        if (L_Upperarm != null && R_Upperarm != null)
        {
            Vector3 angle = L_Upperarm.get_localEulerAngles();
            angle.y = -40f;
            L_Upperarm.set_localEulerAngles(angle);
            angle   = R_Upperarm.get_localEulerAngles();
            angle.y = -40f;
            R_Upperarm.set_localEulerAngles(angle);
        }
        if (lo_face != null)
        {
            Transform face = lo_face.Realizes(head_node, _transform.get_gameObject().get_layer());
            PlayerLoader.SetSkinColor(face, skin_color);
            _SetMannequinMaterial(face);
        }
        if (lo_hair != null)
        {
            Transform hair = lo_hair.Realizes(head_node, _transform.get_gameObject().get_layer());
            PlayerLoader.SetEquipColor(hair, hair_color);
            _SetMannequinMaterial(hair);
        }
        if (lo_arm != null)
        {
            Transform arm = PlayerLoader.AddSkin(lo_arm, body_skin, _transform.get_gameObject().get_layer());
            PlayerLoader.SetSkinAndEquipColor(arm, skin_color, (!is_arm) ? mannequin_color : equip_color, (!is_arm) ? 0.0001f : model_data.GetZBias());
            if (is_arm)
            {
                PlayerLoader.InvisibleBodyTriangles(model_data.bodyDraw, body_skin);
            }
            if (!is_arm)
            {
                _SetMannequinMaterial(arm);
            }
        }
        if (lo_leg != null)
        {
            Transform leg = PlayerLoader.AddSkin(lo_leg, body_skin, _transform.get_gameObject().get_layer());
            PlayerLoader.SetSkinAndEquipColor(leg, skin_color, (!is_leg) ? mannequin_color : equip_color, (!is_leg) ? 0.0001f : model_data.GetZBias());
            if (!is_leg)
            {
                _SetMannequinMaterial(leg);
            }
        }
        if (is_bdy)
        {
            displayInfo = MonoBehaviourSingleton <GlobalSettingsManager> .I.uiModelRendering.armorDisplayInfo;
        }
        else if (is_arm)
        {
            displayInfo = MonoBehaviourSingleton <GlobalSettingsManager> .I.uiModelRendering.armDisplayInfo;
        }
        else if (is_leg)
        {
            displayInfo = MonoBehaviourSingleton <GlobalSettingsManager> .I.uiModelRendering.legDisplayInfo;
        }
        OnLoadFinished();
    }