public static Animation AddAnimationScrollWinHistory(Messages.AnimationMessage msg) { RectTransform elementTransform = GetMessageTransform(msg); if (animatedTransforms.ContainsKey(elementTransform) == false) { animatedTransforms.Add(elementTransform, new List <Animation>()); } Animation anim = new Animation(msg.messageID, msg.dependencyID, Messages.AnimationMessage.AnimationMessageTypes.Scroll, elementTransform, msg.text, AssetLoader.GetSprite(msg.spriteIndexInArray)); animatedTransforms[elementTransform].Add(anim); // transfromToScale.GetComponent<BoardElement>().AddAnimationToPlay(anim); return(anim); }
public static Animation AddAnimationChangeSprite(Messages.AnimationMessage msg) { RectTransform elementTransform = GetMessageTransform(msg); if (animatedTransforms.ContainsKey(elementTransform) == false) { animatedTransforms.Add(elementTransform, new List <Animation>()); } Animation anim = new Animation(msg.messageID, msg.dependencyID, msg.type, elementTransform, AssetLoader.GetSprite(msg.spriteIndexInArray), new Color(msg.targetX, msg.targetY, msg.targetZ, msg.targetW)); animatedTransforms[elementTransform].Add(anim); // transfromToScale.GetComponent<BoardElement>().AddAnimationToPlay(anim); return(anim); }
/// <summary> /// Scale local scale of a transfrom to one /// </summary> public static Animation AddAnimationScaleTo(Messages.AnimationMessage msg) { RectTransform transfromToScale = GetMessageTransform(msg); if (animatedTransforms.ContainsKey(transfromToScale) == false) { animatedTransforms.Add(transfromToScale, new List <Animation>()); } Animation anim = new Animation(msg.messageID, msg.dependencyID, transfromToScale, msg.speed, Messages.AnimationMessage.AnimationMessageTypes.Scale, new Vector3(msg.targetX, msg.targetY, msg.targetZ)); animatedTransforms[transfromToScale].Add(anim); // transfromToScale.GetComponent<BoardElement>().AddAnimationToPlay(anim); return(anim); }
private static RectTransform GetMessageTransform(Messages.AnimationMessage message) { RectTransform trans = inst.canvasTransform; for (int y = 0; y < message.indexInHierarchy.Length; y++) { // Debug.Log(message.type); // Debug.Log("index: " + y); // Debug.Log(trans.name); trans = trans.GetChild(message.indexInHierarchy[y]).GetComponent <RectTransform>(); } //Debug.Log("End"); return(trans); }
/// <summary> /// Move a transfrom to a position /// </summary> public static Animation AddAnimationMoveToPosition(Messages.AnimationMessage msg) { RectTransform tranformToMove = GetMessageTransform(msg); if (animatedTransforms.ContainsKey(tranformToMove) == false) { animatedTransforms.Add(tranformToMove, new List <Animation>()); } Animation anim; if (msg.posCollum == -1 || msg.posRow == -1) { anim = new Animation(msg.messageID, msg.dependencyID, tranformToMove, msg.speed, Messages.AnimationMessage.AnimationMessageTypes.MoveTo, new Vector3(msg.targetX, msg.targetY, msg.targetZ)); } else { anim = new Animation(msg.messageID, msg.dependencyID, tranformToMove, msg.speed, Messages.AnimationMessage.AnimationMessageTypes.MoveTo, positionsOnWorld[msg.posCollum, msg.posRow]); } // tranformToMove.GetComponent<BoardElement>().AddAnimationToPlay(anim); animatedTransforms[tranformToMove].Add(anim); return(anim); }
public static Animation AddAnimationPopUpBox(Messages.AnimationMessage msg) { RectTransform elementTransform = GetMessageTransform(msg); if (animatedTransforms.ContainsKey(elementTransform) == false) { animatedTransforms.Add(elementTransform, new List <Animation>()); } Sprite spr = null; if (msg.spriteIndexInArray > -1) { spr = AssetLoader.GetSprite(msg.spriteIndexInArray); } else { spr = AssetLoader.GetSprite(ConstantValues.AvailableSprites.transparent); } Animation anim = new Animation(msg.messageID, msg.dependencyID, Messages.AnimationMessage.AnimationMessageTypes.PopUpBox, elementTransform, msg.text, spr); animatedTransforms[elementTransform].Add(anim); // transfromToScale.GetComponent<BoardElement>().AddAnimationToPlay(anim); return(anim); }