Beispiel #1
0
        private void initType(AssetPathData assetData)
        {
            ResourceRequest request = Resources.LoadAsync <GameObject> (assetData.path);

            _resourceDataList.Add(assetData.id, request);
            resourceLoadCount++;
        }
Beispiel #2
0
 public void addAssetDataToLoad(AssetPathData assetData)
 {
     if (!_resourceDataList.ContainsKey(assetData.id))
     {
         _assetDataList.Add(assetData);
     }
 }
Beispiel #3
0
        private GameObject addDialog(AssetPathData assetData, int index = 0)
        {
            float      startX = (index > 0) ? (index - 2) * OFFSET_X : 0;
            GameObject panel  = (GameObject)Instantiate(Resources.Load(assetData.path), new Vector3(startX, 0, 0), Quaternion.identity);

            panel.name = (index > 0) ? assetData.id + index : assetData.id;
            panel.transform.SetParent(gameObject.transform, false);
            return(panel);
        }
Beispiel #4
0
        public GameObject getResourceByAssetData(AssetPathData assetData)
        {
            if (_resourceDataList.ContainsKey(assetData.id))
            {
                return((GameObject)_resourceDataList [assetData.id].asset);
            }

            return((GameObject)Resources.Load(assetData.path));
        }
Beispiel #5
0
        private void createCanvas(AssetPathData assetPathData)
        {
            GameObject canvasStyle;
            GameObject canvasGO;

            canvasStyle   = Resources.Load <GameObject> (assetPathData.path);
            canvasGO      = GameObject.Instantiate(canvasStyle) as GameObject;
            canvasGO.name = assetPathData.id;
            canvasGO.transform.SetParent(contextView.transform, false);
        }
Beispiel #6
0
        private void onAddDialog(DialogType type)
        {
            if (_openDialog > 0)
            {
                return;
            }

            AssetPathData dialogData = null;

            switch (type)
            {
            case DialogType.WIN_GAME:
                dialogData = AssetConfig.DIALOG_WIN_GAME;
                break;

            case DialogType.PAUSE_GAME:
                dialogData = AssetConfig.DIALOG_PAUSE_GAME;
                break;

            case DialogType.LOSE_GAME:
                dialogData = AssetConfig.DIALOG_LOSE_GAME;
                break;

            case DialogType.CHOOSE_WAVE:
                dialogData = AssetConfig.DIALOG_CHOOSE_WAVE;
                break;

            case DialogType.WEAPON_EDIT:
                dialogData = AssetConfig.DIALOG_WEAPON_EDIT;
                break;
            }

            if (dialogData != null)
            {
                GameObject           dialogStyle = resourceManager.getResourceByAssetData(dialogData);
                GameObject           dialogGO    = view.addDialog(dialogStyle, dialogData.id);
                ITransformDialogView dialogView  = dialogGO.GetComponent <TransformDialogView> ();
                dialogView.updateBgTransform(_rectTransform);
                _openDialog++;
            }
        }
Beispiel #7
0
        //The render layer to which the GameObjects will be assigned
        //private int layer;
        //An id tacked on to the name to make it easier to track individual instances

        //This provider is instantiated multiple times in GameContext.
        //Each time, we provide the name of the prefab we're loading from
        //a resources folder, and the layer to which the resulting instance
        //
        public ResourceInstanceProvider(AssetPathData assetData, IResourceManager resourceManager)
        {
            _assetData       = assetData;
            _resourceManager = resourceManager;
        }