Example #1
0
    public static GUIMonsterIcon MakePrefabByMonsterData(MonsterData monsterData, Vector3 vScl, Vector3 vPos, Transform parent = null, bool initIconState = true, bool readTexByASync = false)
    {
        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(GUIMonsterIcon.goMONSTER_ICON_M);

        gameObject.SetActive(true);
        Transform transform = gameObject.transform;

        if (parent == null)
        {
            transform.parent = GUIMonsterIcon.goMONSTER_ICON_BAK_ROOT.transform;
        }
        else
        {
            transform.parent = parent;
        }
        transform.localScale    = vScl;
        transform.localPosition = vPos;
        GUIMonsterIcon component = gameObject.GetComponent <GUIMonsterIcon>();

        component.ReadTexByASync = readTexByASync;
        component.data           = monsterData;
        component.ShowGUI();
        if (initIconState)
        {
            component.SetGrayout(GUIMonsterIcon.DIMM_LEVEL.ACTIVE);
            component.SelectNum = -1;
            component.DimmMess  = string.Empty;
            component.SortMess  = string.Empty;
            if (monsterData != null && monsterData.userMonster != null)
            {
                component.Lock = monsterData.userMonster.IsLocked;
            }
        }
        return(component);
    }