public void AttachGameObject(GameObject wItem, KeyValuePair <AutoSpriteControlBase, Vector2> Data) { if (null == wItem) { TsLog.LogWarning("AttachGameObject is null ", new object[] { wItem }); return; } GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(wItem, Vector3.zero, Quaternion.identity); gameObject.name = NrTSingleton <UIDataManager> .Instance.AttachEffectKeyName; if (null == gameObject) { return; } MsgHandler.Handle("SetAllChildLayer", new object[] { gameObject, GUICamera.UILayer }); if (null == Data.Key) { UnityEngine.Object.Destroy(gameObject.gameObject); return; } AutoSpriteControlBase key = Data.Key; if (null == key) { UnityEngine.Object.Destroy(gameObject.gameObject); return; } if (null == key.gameObject) { UnityEngine.Object.Destroy(gameObject.gameObject); return; } Vector2 value = Data.Value; gameObject.transform.parent = key.gameObject.transform; gameObject.transform.localPosition = new Vector3(value.x / 2f, -value.y / 2f, key.gameObject.transform.localPosition.z - 0.1f); key.ExcuteGameObjectDelegate(key, gameObject); }
private void _funcUIEffectDownloaded(IDownloadedItem wItem, object obj) { if (null == wItem.mainAsset) { TsLog.LogWarning("wItem.mainAsset is null -> Path = {0}", new object[] { wItem.assetPath }); return; } GameObject gameObject = wItem.mainAsset as GameObject; if (null == gameObject) { return; } if (TsPlatform.IsMobile && TsPlatform.IsEditor) { MsgHandler.Handle("SetEditorShaderConvert", new object[] { gameObject }); } GameObject gameObject2 = (GameObject)UnityEngine.Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity); gameObject2.name = NrTSingleton <UIDataManager> .Instance.AttachEffectKeyName; if (null == gameObject2) { UnityEngine.Object.Destroy(gameObject.gameObject); return; } MsgHandler.Handle("SetAllChildLayer", new object[] { gameObject2, GUICamera.UILayer }); KeyValuePair <AutoSpriteControlBase, Vector2> keyValuePair = (KeyValuePair <AutoSpriteControlBase, Vector2>)obj; if (null == keyValuePair.Key) { UnityEngine.Object.Destroy(gameObject2.gameObject); return; } AutoSpriteControlBase key = keyValuePair.Key; if (null == key) { UnityEngine.Object.Destroy(gameObject2.gameObject); return; } if (null == key.gameObject) { UnityEngine.Object.Destroy(gameObject2.gameObject); return; } Vector2 value = keyValuePair.Value; gameObject2.transform.parent = key.gameObject.transform; gameObject2.transform.localPosition = new Vector3(value.x / 2f, -value.y / 2f, key.gameObject.transform.localPosition.z - 0.1f); key.ExcuteGameObjectDelegate(key, gameObject2); }