private void initType(AssetPathData assetData) { ResourceRequest request = Resources.LoadAsync <GameObject> (assetData.path); _resourceDataList.Add(assetData.id, request); resourceLoadCount++; }
public void addAssetDataToLoad(AssetPathData assetData) { if (!_resourceDataList.ContainsKey(assetData.id)) { _assetDataList.Add(assetData); } }
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); }
public GameObject getResourceByAssetData(AssetPathData assetData) { if (_resourceDataList.ContainsKey(assetData.id)) { return((GameObject)_resourceDataList [assetData.id].asset); } return((GameObject)Resources.Load(assetData.path)); }
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); }
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++; } }
//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; }