Esempio n. 1
0
    public void LoadSprite(SPUM_SpriteList data)
    {
        //스프라이트 데이터 연동
        SetSpriteList(_hairList, data._hairList);
        SetSpriteList(_bodyList, data._bodyList);
        SetSpriteList(_clothList, data._clothList);
        SetSpriteList(_armorList, data._armorList);
        SetSpriteList(_pantList, data._pantList);
        SetSpriteList(_weaponList, data._weaponList);
        SetSpriteList(_backList, data._backList);

        //색 데이터 연동.
        _eyeList[0].color  = data._eyeList[0].color;
        _eyeList[1].color  = data._eyeList[1].color;
        _hairList[3].color = data._hairList[3].color;
        _hairList[0].color = data._hairList[0].color;
        //꺼져있는 오브젝트 데이터 연동.
        _eyeList[0].gameObject.SetActive(!data._eyeList[0].gameObject.activeInHierarchy);
        _eyeList[1].gameObject.SetActive(!data._eyeList[1].gameObject.activeInHierarchy);
        _hairList[0].gameObject.SetActive(!data._hairList[0].gameObject.activeInHierarchy);
        _hairList[3].gameObject.SetActive(!data._hairList[3].gameObject.activeInHierarchy);

        _hairListString   = data._hairListString;
        _clothListString  = data._clothListString;
        _pantListString   = data._pantListString;
        _armorListString  = data._armorListString;
        _weaponListString = data._weaponListString;
        _backListString   = data._backListString;
    }
Esempio n. 2
0
    //프리팹 저장 부분
    public void SavePrefabs()
    {
        if (_prefabUnitList.Count < _maxNumber)
        {
            string prefabName = _unitCode.text;

            SPUM_Prefabs ttObjST = _unitObjSet.GetComponent <SPUM_Prefabs>();
            ttObjST._code   = prefabName;
            ttObjST.EditChk = false;

            SPUM_SpriteList tSpST = ttObjST._spriteOBj;
            SyncPath(tSpST._hairList, tSpST._hairListString);
            SyncPath(tSpST._clothList, tSpST._clothListString);
            SyncPath(tSpST._armorList, tSpST._armorListString);
            SyncPath(tSpST._pantList, tSpST._pantListString);
            SyncPath(tSpST._weaponList, tSpST._weaponListString);
            SyncPath(tSpST._backList, tSpST._backListString);

            GameObject tObj = PrefabUtility.SaveAsPrefabAsset(_unitObjSet.gameObject, unitPath + prefabName + ".prefab");

            _prefabUnitList.Add(tObj);

            ttObjST._code   = "";
            ttObjST.EditChk = true;

            ToastOn("Saved Unit Object " + prefabName);
            _unitCode.text = GetFileName();
            editObjNum     = -1;
        }
    }
Esempio n. 3
0
    public void LoadUnitDataName(int index)
    {
        SPUM_SpriteList tObjST = _prefabUnitList[index].GetComponent <SPUM_Prefabs>()._spriteOBj;

        _spriteObj.LoadSprite(tObjST);

        //UI연동.
        _colorButton[0].color = tObjST._eyeList[0].color;
        _colorButton[1].color = tObjST._hairList[3].color;
        _colorButton[2].color = tObjST._hairList[0].color;

        _unitCode.text = (_prefabUnitList[index].name).Split('.')[0];
    }
    public void LoadSprite(SPUM_SpriteList data)
    {
        //스프라이트 데이터 연동
        SetSpriteList(_hairList, data._hairList);
        SetSpriteList(_bodyList, data._bodyList);
        SetSpriteList(_clothList, data._clothList);
        SetSpriteList(_armorList, data._armorList);
        SetSpriteList(_pantList, data._pantList);
        SetSpriteList(_weaponList, data._weaponList);
        SetSpriteList(_backList, data._backList);
        SetSpriteList(_eyeList, data._eyeList);

        if (data._spHorseSPList != null)
        {
            SetSpriteList(_spHorseSPList._spList, data._spHorseSPList._spList);
            _spHorseSPList = data._spHorseSPList;
        }
        else
        {
            _spHorseSPList = null;
        }

        //색 데이터 연동.
        if (_eyeList.Count > 2 && data._eyeList.Count > 2)
        {
            _eyeList[2].color = data._eyeList[2].color;
            _eyeList[3].color = data._eyeList[3].color;
        }

        _hairList[3].color = data._hairList[3].color;
        _hairList[0].color = data._hairList[0].color;
        //꺼져있는 오브젝트 데이터 연동.x
        _hairList[0].gameObject.SetActive(!data._hairList[0].gameObject.activeInHierarchy);
        _hairList[3].gameObject.SetActive(!data._hairList[3].gameObject.activeInHierarchy);

        _hairListString   = data._hairListString;
        _clothListString  = data._clothListString;
        _pantListString   = data._pantListString;
        _armorListString  = data._armorListString;
        _weaponListString = data._weaponListString;
        _backListString   = data._backListString;
    }
Esempio n. 5
0
    public void OpenLoadData()
    {
        if (_prefabUnitList.Count == 0)
        {
            ToastOn("There is no any saved Unit");
            return;
        }

        if (_loadPool.childCount > 0)
        {
            for (var i = 0; i < _loadPool.childCount; i++)
            {
                Destroy(_loadPool.GetChild(i).gameObject);
            }
        }


        for (var j = 0; j < _prefabUnitList.Count; j++)
        {
            GameObject      tObj   = _prefabUnitList[j];
            SPUM_SpriteList tObjST = tObj.GetComponent <SPUM_Prefabs>()._spriteOBj;

            GameObject ttObj = Instantiate(_childItem) as GameObject;
            ttObj.transform.SetParent(_loadPool);
            ttObj.transform.localScale = new Vector3(1, 1, 1);

            SPUM_PreviewItem ttObjST = ttObj.GetComponent <SPUM_PreviewItem>();
            ttObjST.ShowObj(5);
            //아이템 연동 부분
            ttObjST._fullSetList[0].sprite = tObjST._bodyList[0].sprite;
            ttObjST._fullSetList[1].sprite = tObjST._bodyList[1].sprite;
            ttObjST._fullSetList[2].sprite = tObjST._bodyList[2].sprite;
            ttObjST._fullSetList[3].sprite = tObjST._bodyList[3].sprite;
            ttObjST._fullSetList[4].sprite = tObjST._bodyList[4].sprite;
            ttObjST._fullSetList[5].sprite = tObjST._bodyList[5].sprite;

            ttObjST._fullSetList[6].sprite = tObjST._eyeList[0].sprite;
            ttObjST._fullSetList[7].sprite = tObjST._eyeList[0].sprite;

            ttObjST._fullSetList[8].sprite  = tObjST._hairList[3].sprite;
            ttObjST._fullSetList[9].sprite  = tObjST._hairList[0].sprite;
            ttObjST._fullSetList[10].sprite = tObjST._hairList[1].sprite;

            ttObjST._fullSetList[11].sprite = tObjST._clothList[0].sprite;
            ttObjST._fullSetList[12].sprite = tObjST._clothList[1].sprite;
            ttObjST._fullSetList[13].sprite = tObjST._clothList[2].sprite;

            ttObjST._fullSetList[14].sprite = tObjST._armorList[0].sprite;
            ttObjST._fullSetList[15].sprite = tObjST._armorList[1].sprite;
            ttObjST._fullSetList[16].sprite = tObjST._armorList[2].sprite;

            ttObjST._fullSetList[17].sprite = tObjST._pantList[0].sprite;
            ttObjST._fullSetList[18].sprite = tObjST._pantList[1].sprite;

            ttObjST._fullSetList[19].sprite = tObjST._weaponList[0].sprite;
            ttObjST._fullSetList[20].sprite = tObjST._weaponList[1].sprite;

            ttObjST._fullSetList[21].sprite = tObjST._weaponList[2].sprite;
            ttObjST._fullSetList[22].sprite = tObjST._weaponList[3].sprite;

            ttObjST._fullSetList[23].sprite = tObjST._backList[0].sprite;

            //string 연동


            //색연동
            if (!tObjST._eyeList[0].gameObject.activeInHierarchy)
            {
                ttObjST._fullSetList[6].gameObject.SetActive(true);
                ttObjST._fullSetList[7].gameObject.SetActive(true);

                ttObjST._fullSetList[6].color = tObjST._eyeList[0].color;
                ttObjST._fullSetList[7].color = tObjST._eyeList[0].color;
            }
            else
            {
                ttObjST._fullSetList[6].gameObject.SetActive(false);
                ttObjST._fullSetList[7].gameObject.SetActive(false);
            }

            if (!tObjST._hairList[3].gameObject.activeInHierarchy)
            {
                ttObjST._fullSetList[8].gameObject.SetActive(true);
                ttObjST._fullSetList[8].color = tObjST._hairList[3].color;
            }
            else
            {
                ttObjST._fullSetList[8].gameObject.SetActive(false);
            }

            if (!tObjST._hairList[0].gameObject.activeInHierarchy)
            {
                ttObjST._fullSetList[9].gameObject.SetActive(true);
                ttObjST._fullSetList[9].color = tObjST._hairList[0].color;
            }
            else
            {
                ttObjST._fullSetList[9].gameObject.SetActive(true);
            }

            for (var i = 0; i < ttObjST._fullSetList.Count; i++)
            {
                ttObjST._fullSetList[i].SetNativeSize();
                if (ttObjST._fullSetList[i].sprite != null)
                {
                    ttObjST._fullSetList[i].gameObject.SetActive(true);
                    ttObjST._fullSetList[i].rectTransform.pivot = new Vector2(ttObjST._fullSetList[i].sprite.pivot.x / ttObjST._fullSetList[i].sprite.rect.width, ttObjST._fullSetList[i].sprite.pivot.y / ttObjST._fullSetList[i].sprite.rect.height);
                }
                else
                {
                    ttObjST._fullSetList[i].gameObject.SetActive(false);
                }
            }

            ttObjST._name      = _prefabUnitList[j].name;
            ttObjST._managerST = this;
            ttObjST._itemType  = 11;
            ttObjST._index     = j;
            ttObjST.DeleteButton.SetActive(true);
        }
        _loadObjCanvas.SetActive(true);
    }