少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Snxxz.UI;
 
public class SelectRoleBehaviour
{
    GameObject behaviour;
    Camera ceateRoleCamera;
    CreateRoleHeroPlatform platform;
    ActorShadowCaster shadow;
 
    UI3DShowHero playerModel = new UI3DShowHero();
 
    public void Show()
    {
        LoadAssets(CreateRoleScriptableObject.GetJobParams(PlayerDatas.Instance.loginInfo.Job));
        playerModel.Dispose();
 
        var fashionClothes = 0;
        var fashionWeapon = 0;
        var fashionSecondary = 0;
        var clothesItemId = 0;
        var weaponItemId = 0;
        var wingsItemId = 0;
        var secondaryItemId = 0;
        var suitLevel = 0;
        var equipInfos = PlayerDatas.Instance.loginInfo.EquipInfo;
 
        for (int i = 0; i < equipInfos.Length; i++)
        {
            var equipInfo = equipInfos[i];
            var itemConfig = ItemConfig.Get((int)equipInfo.ItemID);
            switch ((RoleEquipType)itemConfig.EquipPlace)
            {
                case RoleEquipType.FashionClothes:
                    fashionClothes = (int)equipInfo.ItemID;
                    break;
                case RoleEquipType.FashionWeapon:
                    fashionWeapon = (int)equipInfo.ItemID;
                    break;
                case RoleEquipType.FashionWeapon2:
                    fashionSecondary = (int)equipInfo.ItemID;
                    break;
                case RoleEquipType.Weapon:
                    weaponItemId = (int)equipInfo.ItemID;
                    break;
                case RoleEquipType.Clothes:
                    clothesItemId = (int)equipInfo.ItemID;
                    break;
                case RoleEquipType.Wing:
                    wingsItemId = (int)equipInfo.ItemID;
                    break;
                case RoleEquipType.Weapon2:
                    secondaryItemId = (int)equipInfo.ItemID;
                    break;
            }
        }
 
        var data = new UI3DPlayerExhibitionData()
        {
            job = PlayerDatas.Instance.loginInfo.Job,
            fashionClothesId = fashionClothes,
            clothesId = clothesItemId,
            suitLevel = suitLevel,
            fashionWeaponId = fashionWeapon,
            weaponId = weaponItemId,
            wingsId = wingsItemId,
            fashionSecondaryId = fashionSecondary,
            secondaryId = secondaryItemId,
        };
 
        ceateRoleCamera.gameObject.SetActive(true);
        var model = playerModel.Show(data, platform.transform);
        playerModel.StandUp();
        shadow.gameObject.SetActive(true);
        shadow.Cast(model.transform);
    }
 
    public void Hide()
    {
        if (ceateRoleCamera != null)
        {
            ceateRoleCamera.gameObject.SetActive(false);
        }
 
        if (shadow != null)
        {
            shadow.gameObject.SetActive(false);
        }
    }
 
    public void Dispose()
    {
        behaviour = null;
        ceateRoleCamera = null;
        platform = null;
        shadow = null;
        playerModel = null;
    }
 
    private void LoadAssets(CreateRoleScriptableObject.RoleShowParams showParams)
    {
        if (behaviour == null)
        {
            var prefab = SceneLoader.LoadCreateRole(showParams.platformPrefabName);
            behaviour = GameObject.Instantiate(prefab, showParams.platformPosition, Quaternion.identity);
            behaviour.name = showParams.platformPrefabName;
            shadow = behaviour.GetComponentInChildren<ActorShadowCaster>();
            platform = behaviour.GetComponentInChildren<CreateRoleHeroPlatform>();
            platform.transform.localScale = showParams.platformScale;
            ceateRoleCamera = behaviour.GetComponentInChildren<Camera>();
        }
    }
}