public override void ready() { base.ready(); items = new List <ItemData>(); foreach (BumModel item in BumLogic.objectManager.modelCollection.Values) { items.Add(item); } mainPage.producScroll.OnModelClick = OnProductItemClickByShowCAD; mainPage.downButton.onClick.AddListener(OnDownButton); //mainPage.downRemoveButton.onClick.AddListener(OnDownRemoveButton); mainPage.adjustButton.onClick.AddListener(OnAdjustButton); mainPage.hideButton.onClick.AddListener(OnHideButton); mainPage.cancelButton.onClick.AddListener(OnDownRemoveButton); mainPage.extendButton.onClick.AddListener(OnExtendButton); mainPage.producScroll.Display(items); myTweenScale = mainPage.ProductPlane.gameObject.AddComponent <MyTweenScale>(); myTweenScale.from = Vector3.zero; myTweenScale.to = Vector3.one; myTweenScale.style = Style.Once; myTweenScale.moveType = MoveType.Linear; myTweenScale.duration = .5f; inputStateMachine.Ready(); }
public override void OnInspectorGUI() { GUILayout.Space(6f); EditorGUIUtility.labelWidth = 120f; MyTweenScale tw = target as MyTweenScale; GUI.changed = false; Vector3 from = EditorGUILayout.Vector3Field("From", tw.from); Vector3 to = EditorGUILayout.Vector3Field("To", tw.to); if (GUI.changed) { MyEditorTool.RegisterUndo("Tween Change", tw); tw.from = from; tw.to = to; MyEditorTool.SetDirty(tw); } DrawCommonProperties(); }
void OnEnable() { if (usePosition && fromPosition != toPosition) { MyTweenPosition tweenPos = this.gameObject.GetComponent <MyTweenPosition>(); if (tweenPos == null) { tweenPos = this.gameObject.AddComponent <MyTweenPosition>(); } tweenPos.worldSpace = worldSpace; tweenPos.style = usePositionType; tweenPos.from = fromPosition + transform.localPosition; tweenPos.to = toPosition + transform.localPosition; tweenPos.duration = timeOfPositionOnce; tweenPos.curve = animationCurve_Position; tweenPos.ResetToBeginning(); tweenPos.PlayForward(); } else { } if (useScale && fromScale != toScale) { MyTweenScale tweenScal = this.gameObject.GetComponent <MyTweenScale>(); if (tweenScal == null) { tweenScal = this.gameObject.AddComponent <MyTweenScale>(); } tweenScal.style = useScaleType; tweenScal.from = fromScale; tweenScal.to = toScale; tweenScal.duration = timeOfScaleOnce; tweenScal.curve = animationCurve_Scale; tweenScal.ResetToBeginning(); tweenScal.PlayForward(); } else { } if (useRotat && fromAngle != toAngle) { MyTweenRotation tweenRotat = this.gameObject.GetComponent <MyTweenRotation>(); if (tweenRotat == null) { tweenRotat = this.gameObject.AddComponent <MyTweenRotation>(); } tweenRotat.style = useRotatType; tweenRotat.from = fromAngle; tweenRotat.to = toAngle; tweenRotat.duration = timeOfRotatOnce; tweenRotat.curve = animationCurve_Rotation; tweenRotat.ResetToBeginning(); tweenRotat.PlayForward(); } else { } if (useColor && fromColor != toColor) { MyTweenColor tweenColor = this.gameObject.GetComponent <MyTweenColor>(); if (tweenColor == null) { tweenColor = this.gameObject.AddComponent <MyTweenColor>(); } tweenColor.renderType = type; tweenColor.shaderColorName = shaderColorName; tweenColor.style = useColorType; tweenColor.from = fromColor; tweenColor.to = toColor; tweenColor.duration = timeOfColorOnce; tweenColor.curve = animationCurve_Color; tweenColor.ResetToBeginning(); tweenColor.PlayForward(); } else { } }