当前位置: 首页>>代码示例>>C#>>正文


C# LTDescr.onUpdateColor方法代码示例

本文整理汇总了C#中LTDescr.onUpdateColor方法的典型用法代码示例。如果您正苦于以下问题:C# LTDescr.onUpdateColor方法的具体用法?C# LTDescr.onUpdateColor怎么用?C# LTDescr.onUpdateColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LTDescr的用法示例。


在下文中一共展示了LTDescr.onUpdateColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: update


//.........这里部分代码省略.........
                                }
                                if(trans.childCount>0){
                                    foreach (Transform child in trans) {
                                        if(child.gameObject.renderer!=null){
                                            foreach(Material mat in child.gameObject.renderer.materials){
                                                mat.color = new Color( mat.color.r, mat.color.g, mat.color.b, val);
                                            }
                                        }
                                    }
                                }
                            }

                            #endif
                        }else if(tweenAction==TweenAction.ALPHA_VERTEX){
                            Mesh mesh = trans.GetComponent<MeshFilter>().mesh;
                            Vector3[] vertices = mesh.vertices;
                            Color32[] colors = new Color32[vertices.Length];
                            Color32 c = mesh.colors32[0];
                            c = new Color( c.r, c.g, c.b, val);
                            for (int k= 0; k < vertices.Length; k++) {
                                colors[k] = c;
                            }
                            mesh.colors32 = colors;
                        }else if(tweenAction==TweenAction.COLOR || tweenAction==TweenAction.CALLBACK_COLOR){
                            Color toColor = tweenColor(tween, val);
                            // Debug.Log("val:"+val+" tween:"+tween+" tween.diff:"+tween.diff);
                            if(tweenAction==TweenAction.COLOR){
                                if(trans.gameObject.renderer!=null){
                                    foreach(Material mat in trans.gameObject.renderer.materials){
                                        mat.color = toColor;
                                    }
                                }
                            }else if(tweenAction==TweenAction.CALLBACK_COLOR){
                                tween.onUpdateColor(toColor);
                            }
                        }

                    }else if(tweenAction>=TweenAction.MOVE){
                        //

                        if(tween.animationCurve!=null){
                            newVect = tweenOnCurveVector(tween, ratioPassed);
                        }else{
                            if(tween.tweenType == LeanTweenType.linear){
                                newVect = new Vector3( tween.from.x + tween.diff.x * ratioPassed, tween.from.y + tween.diff.y * ratioPassed, tween.from.z + tween.diff.z * ratioPassed);
                            }else if(tween.tweenType >= LeanTweenType.linear){
                                switch(tween.tweenType){
                                    case LeanTweenType.easeOutQuad:
                                        newVect = new Vector3(easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break;
                                    case LeanTweenType.easeInQuad:
                                        newVect = new Vector3(easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeInQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeInQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break;
                                    case LeanTweenType.easeInOutQuad:
                                        newVect = new Vector3(easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeInOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeInOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break;
                                    case LeanTweenType.easeInCubic:
                                        newVect = new Vector3(easeInCubic(tween.from.x, tween.to.x, ratioPassed), easeInCubic(tween.from.y, tween.to.y, ratioPassed), easeInCubic(tween.from.z, tween.to.z, ratioPassed)); break;
                                    case LeanTweenType.easeOutCubic:
                                        newVect = new Vector3(easeOutCubic(tween.from.x, tween.to.x, ratioPassed), easeOutCubic(tween.from.y, tween.to.y, ratioPassed), easeOutCubic(tween.from.z, tween.to.z, ratioPassed)); break;
                                    case LeanTweenType.easeInOutCubic:
                                        newVect = new Vector3(easeInOutCubic(tween.from.x, tween.to.x, ratioPassed), easeInOutCubic(tween.from.y, tween.to.y, ratioPassed), easeInOutCubic(tween.from.z, tween.to.z, ratioPassed)); break;
                                    case LeanTweenType.easeInQuart:
                                        newVect = new Vector3(easeInQuart(tween.from.x, tween.to.x, ratioPassed), easeInQuart(tween.from.y, tween.to.y, ratioPassed), easeInQuart(tween.from.z, tween.to.z, ratioPassed)); break;
                                    case LeanTweenType.easeOutQuart:
                                        newVect = new Vector3(easeOutQuart(tween.from.x, tween.to.x, ratioPassed), easeOutQuart(tween.from.y, tween.to.y, ratioPassed), easeOutQuart(tween.from.z, tween.to.z, ratioPassed)); break;
                                    case LeanTweenType.easeInOutQuart:
                                        newVect = new Vector3(easeInOutQuart(tween.from.x, tween.to.x, ratioPassed), easeInOutQuart(tween.from.y, tween.to.y, ratioPassed), easeInOutQuart(tween.from.z, tween.to.z, ratioPassed)); break;
                                    case LeanTweenType.easeInQuint:
开发者ID:KittyMac,项目名称:LeanTween,代码行数:67,代码来源:LeanTween.cs

示例2: update


//.........这里部分代码省略.........
								{
									ren.color = toColor;
								}
								else
								{
#endif
									// Debug.Log("val:"+val+" tween:"+tween+" tween.diff:"+tween.diff);
									if (tweenAction == TweenAction.COLOR)
									{
										if (trans.gameObject.GetComponent<Renderer>() != null)
										{
											foreach (Material mat in trans.gameObject.GetComponent<Renderer>().materials)
											{
												mat.color = toColor;
											}
										}
										if (trans.childCount > 0)
										{
											foreach (Transform child in trans)
											{
												if (child.gameObject.GetComponent<Renderer>() != null)
												{
													foreach (Material mat in child.gameObject.GetComponent<Renderer>().materials)
													{
														mat.color = toColor;
													}
												}
											}
										}
									}
#if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2
								}
#endif
								if (dt != 0f && tween.onUpdateColor != null)
								{
									tween.onUpdateColor(toColor);
								}
							}
#if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_5
							else if (tweenAction == TweenAction.CANVAS_ALPHA)
							{
								Color c = tween.uiImage.color;
								c.a = val;
								tween.uiImage.color = c;
							}
							else if (tweenAction == TweenAction.CANVAS_COLOR)
							{
								Color toColor = tweenColor(tween, val);
								tween.uiImage.color = toColor;
								if (dt != 0f && tween.onUpdateColor != null)
								{
									tween.onUpdateColor(toColor);
								}
							}
							else if (tweenAction == TweenAction.TEXT_ALPHA)
							{
								textAlphaRecursive(trans, val);
							}
							else if (tweenAction == TweenAction.TEXT_COLOR)
							{
								Color toColor = tweenColor(tween, val);
								tween.uiText.color = toColor;
								if (dt != 0f && tween.onUpdateColor != null)
								{
									tween.onUpdateColor(toColor);
								}
开发者ID:djfdat,项目名称:UnityTemplateProject-FolderStructure,代码行数:67,代码来源:LeanTween.cs


注:本文中的LTDescr.onUpdateColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。