コード例 #1
0
        private IEnumerator loadDecorationPrefab(DecorationRenderParams param)
        {
            AssetRequest <GameObject> decorationRequest;

            try
            {
                decorationRequest = Content.LoadAsync(param.Definition.Prefab);
            }
            catch (Exception)
            {
                Log.LogErrorFormatted(this, "Could not load decoration prefab {0} with prefab key {1}", param.Definition.Name, param.Definition.Prefab.Key);
                yield break;
            }
            if (decorationRequest == null)
            {
                Log.LogErrorFormatted(this, "Something went wrong loading decoration {0}.", param.Definition.Prefab);
                yield break;
            }
            yield return(decorationRequest);

            GameObject decorationGameObject = UnityEngine.Object.Instantiate(decorationRequest.Asset);

            LightCullingMaskHelper.SetLayerIncludingChildren(decorationGameObject.transform, "IconRender");
            yield return(loadDecorationRenderData(param, decorationGameObject));
        }
コード例 #2
0
        protected override IEnumerator processRequest(RenderParams renderParam)
        {
            ItemRenderParams param = renderParam as ItemRenderParams;

            if (penguinPreload != LoadingTriState.FAILURE)
            {
                Color bodyColor = ((param.bodyColor != Color.clear) ? param.bodyColor : defaultBodyColor);
                penguin.transform.localPosition = new Vector3(10f, 0f, 0f);
                avatarModel.ClearAllEquipment();
                try
                {
                    avatarModel.ApplyOutfit(createOutfit(param.equipment));
                }
                catch (Exception ex)
                {
                    Log.LogErrorFormatted(this, "When applying an outfit to the avatar model an error occurred. Icon not rendered. Message: {0}", ex);
                    yield break;
                }
                avatarModel.BeakColor  = bodyColor;
                avatarModel.BellyColor = bodyColor;
                avatarModel.BodyColor  = bodyColor;
                while (!avatarView.IsReady)
                {
                    yield return(null);
                }
                LightCullingMaskHelper.SetLayerIncludingChildren(penguin.transform, "IconRender");
                modifyMaterials(bodyColor);
                yield return(renderToTexture(param));
            }
        }