Ejemplo n.º 1
0
    // 아틀라스 컨테이너에 추가한다 ex : Lobby + Common + Icon  한가지 키로 통합
    private void AddAtlasSprite(string Key, string atlasName)
    {
        SpriteContainer container;

        Sprite[] sprites;

        sprites = Resources.LoadAll <Sprite>(GlobalUtil.AddString(AtlasPath, atlasName));

        if (sprites == null)
        {
            return;
        }

        if (_spriteDictionary.TryGetValue(Key, out container))
        {
            for (int i = 0; i < sprites.Length; ++i)
            {
                container.AddSprite(sprites[i].name, sprites[i]);
            }
        }
        else
        {
            container           = new SpriteContainer();
            container.AtlasName = Key;

            for (int i = 0; i < sprites.Length; ++i)
            {
                container.AddSprite(sprites[i].name, sprites[i]);
            }

            _spriteDictionary.Add(Key, container);
        }

        Debug.Log("Load Atlas : " + container.AtlasName + " , AtlasCount : " + _spriteDictionary.Count);
    }
Ejemplo n.º 2
0
    public void SetClient(ClientInfo client)
    {
        if (client != null)
        {
            _playerInfo = client;

            _uid        = _playerInfo.UniqID;
            _remoteID   = _playerInfo.RemoteID;
            _localIndex = _playerInfo.locaIndex;

            if (IdentityUI != null)
            {
                GlobalUtil.AddString(GlobalUtil.Scolor[client.locaIndex], client.Name, GlobalUtil.ColorEnd);
                IdentityUI.SetUIData(client.UniqID, client.LifeCount, GlobalUtil.GetText);

                if (_playerInfo.IsJoin)
                {
                    IdentityUI.ShowBaseUI();
                }
                else
                {
                    IdentityUI.HideBaseUI();
                }
            }
        }
        else
        {
            if (IdentityUI != null)
            {
                IdentityUI.HideBaseUI();
            }
        }
    }
Ejemplo n.º 3
0
    public void LoadAtlasTexture(AtlasType atlasType, string fileName = null)
    {
        if (atlasType == AtlasType.None && _spriteDictionary.ContainsKey(fileName) ||
            _spriteDictionary.ContainsKey(atlasType.ToString()))
        {
            return;
        }

        GlobalUtil.AddString(AtlasPath, fileName);

        switch (atlasType)
        {
        case AtlasType.Lobby:
            AddAtlasSprite(Lobby, Lobby);
            AddAtlasSprite(Lobby, "Icon_Atlas");
            break;

        case AtlasType.InGAME:
            AddAtlasSprite(Game, "GameTexture");
            AddAtlasSprite(Game, "Icon_Atlas");
            AddAtlasSprite(Game, "GCP_Hud");
            break;

            break;

        default:     // 팝업 단위로 아틀라스 생성시
            AddAtlasSprite(PopAtlasPath, fileName);
            break;
        }
    }
Ejemplo n.º 4
0
    public T CreateWorldUI <T>(Transform target, float offset = 0) where T : UIBase
    {
        GameObject res = Resources.Load <GameObject>(GlobalUtil.AddString("Prefab/UI/3D_UI/", typeof(T).ToString()));

        GameObject obj = Instantiate(res);

        ConvertUIPosition addUI = obj.GetComponent <ConvertUIPosition>();

        if (addUI == null)
        {
            addUI = obj.AddComponent <ConvertUIPosition>();
        }

        addUI.OffsetY = offset;
        addUI.Target  = target;
        obj.transform.SetParent(WorldUI, false);
        T callUI = obj.GetComponent <T>();

        _uniqIndex++;

        // 3D 오브젝트 관리용 Id 를 넣어준다
        callUI.Id = _uniqIndex;

        if (callUI.Block)
        {
            _blockWorldList.Add(callUI);
            CheckPossibleWorldTouch();
        }


        _ownerUIList.Add(callUI);

        return(callUI);
    }
Ejemplo n.º 5
0
    public static T ResourcesLoad <T>(string path) where T : Object
    {
        // 일단 유니티 폴더서 찾고
        T obj = Resources.Load <T>(path);

        if (obj == null)
        {
            // 에셋 번들에서 찾는다.
            GlobalUtil.AddString(Application.persistentDataPath, GameAssetsPath, path);
        }
        return(null);
    }
Ejemplo n.º 6
0
    public static AudioClip LoadBGMAssetData(string clip)
    {
        AssetBundle bundle;

        if (i._loadList.TryGetValue(BGMBundle, out bundle) == false)
        {
            bundle = AssetBundle.LoadFromFile(GlobalUtil.AddString(Application.persistentDataPath, GameAssetsPath, "/bgm.unity3d"));
            i._loadList.Add(BGMBundle, bundle);
        }

        AudioClip bgm = bundle.LoadAsset <AudioClip>(clip);

        return(bgm);
    }
Ejemplo n.º 7
0
    public T CreateHUDUI <T>(string resName) where T : UIBase
    {
        //Debug.Log(resName);

        GameObject res = Resources.Load <GameObject>(GlobalUtil.AddString(_hudPath, resName));

        GameObject obj = Instantiate(res);

        obj.transform.SetParent(HudUI, false);
        T callUI = obj.GetComponent <T>();

        if (callUI)
        {
            _hudManager.AddHUDUI(callUI);
        }

        return(callUI);
    }
Ejemplo n.º 8
0
    public void AddData <T>() where T : UIPopupBase
    {
        if (_dataContainer.ContainsKey(typeof(T)) == false)
        {
            string className = GlobalUtil.AddString(typeof(T).ToString(), DATA);

            var typecheck = Type.GetType(className);

            if (typecheck != null)
            {
                var dataClass = Activator.CreateInstance(Type.GetType(className)) as UIData;

                _dataContainer.Add(typecheck, dataClass);
                _typeContainer.Add(typeof(T), typecheck);
            }
            else
            {
                Debug.Log("UIData is Null : " + className);
            }
        }
    }
Ejemplo n.º 9
0
    private T CreatePopupUI <T>(string folder, UIPopupBase.PopupType type = UIPopupBase.PopupType.POP_UP, bool preOption = false) where T : UIPopupBase
    {
        // SpriteLoad;

        if (type == UIPopupBase.PopupType.FRONT)
        {
            if (_frontPopup)
            {
                _accFrontUI++;
                return(null);
            }
        }

        T bundlePopup = null;

        bundlePopup = GetPoolUI <T>();

        if (bundlePopup == null)
        {
            GameObject res = Resources.Load <GameObject>(GlobalUtil.AddString("Prefab/UI/Popup/", typeof(T).ToString()));

            if (res == null)
            {
                Debug.LogError("Look for Other Resources Path : " + typeof(T).ToString());
                return(null);
            }

            GameObject obj = Instantiate(res);

            bundlePopup = obj.GetComponent <T>();
        }

        selectParentBelongtoUI(bundlePopup, type, preOption);


        _datamanager.AddData <T>();


        return(bundlePopup as T);
    }
Ejemplo n.º 10
0
    public T CreateGameUI <T>() where T : UIBase
    {
        GameObject res = Resources.Load <GameObject>(GlobalUtil.AddString("Prefab/UI/GameUI/", typeof(T).ToString()));

        GameObject obj = Instantiate(res);

        obj.transform.SetParent(WorldUI, false);
        T callUI = obj.GetComponent <T>();

        _inGameUIList.Add(callUI);

        _gameUniqIndex++;

        callUI.Id = _gameUniqIndex;

        if (callUI.Block)
        {
            _blockWorldList.Add(callUI);
            CheckPossibleWorldTouch();
        }

        return(callUI);
    }
Ejemplo n.º 11
0
    T ConfigureDelegate <T>(string methodRoot, T Default, bool isLoading = false) where T : class
    {
        Dictionary <string, Delegate> lookup;

        // not Exist  new
        if (!_cache.TryGetValue(State.currentState, out lookup))
        {
            _cache[State.currentState] = lookup = new Dictionary <string, Delegate>();
        }

        Delegate returnValue;

        if (!lookup.TryGetValue(methodRoot, out returnValue))
        {
            GlobalUtil.AddString(methodRoot, "_", State.currentState.ToString());

            //Debug.Log(sceneState);

            MethodInfo mtd = GetType().GetMethod(isLoading ? methodRoot : GlobalUtil.GetText, System.Reflection.BindingFlags.Instance |
                                                 System.Reflection.BindingFlags.Public |
                                                 System.Reflection.BindingFlags.NonPublic |
                                                 System.Reflection.BindingFlags.InvokeMethod);

            if (mtd != null)
            {
                returnValue = System.Delegate.CreateDelegate(typeof(T), this, mtd);
            }
            else
            {
                returnValue = Default as Delegate;
            }

            lookup[methodRoot] = returnValue;
        }

        return(returnValue as T);
    }
Ejemplo n.º 12
0
    // 기본적으로 번들 이름을 무조건 다운받아서 저장하는 함수
    private IEnumerator GetDownLoadAssetBundle(string bundleName)
    {
        UnityWebRequest www = UnityWebRequest.Get(GlobalUtil.AddString(baseurl, bundleName));

        var async = www.SendWebRequest();

        if (_patchUI)
        {
            _patchUI.SetUIData(0);
        }

        while (!async.isDone)
        {
            if (_patchUI)
            {
                _patchUI.SetUIData(async.progress);
            }
        }

        if (www.isNetworkError)
        {
            Debug.Log(www.isNetworkError);

            yield break;
        }
        else
        {
            // 에셋 번들파일 생성
            var        data = www.downloadHandler.data;
            FileStream fs   = new FileStream(GlobalUtil.AddString(Application.persistentDataPath, GameAssetsPath, GlobalUtil.SLASH, bundleName, Extension), FileMode.Create);
            fs.Write(data, 0, data.Length);
            fs.Close();

            Debug.Log("Create file AssetBundle : " + bundleName);
        }
    }
Ejemplo n.º 13
0
 public override void SetUIData(int progress)
 {
     _progress.text = GlobalUtil.AddString(progress.ToString(), percent);
 }
Ejemplo n.º 14
0
 void Start()
 {
     _progress.text = GlobalUtil.AddString(zero, percent);
 }