コード例 #1
0
    // Open the menu with a certain style
    public void Open(AnimationStyle inStyle)
    {
        // If we've already opened or we're still animating,
        // don't start the open animation
        if (m_Open || m_TransitionAnimation)
        {
            return;
        }
        m_Open = true;

        m_Style = inStyle;

        // Select the appropriate opening animation based on our style
        switch (m_Style)
        {
        case AnimationStyle.Fade:
            m_TransitionAnimation.Replace(this, FadeIn());
            break;

        case AnimationStyle.Scale:
            m_TransitionAnimation.Replace(this, ScaleIn());
            break;

        case AnimationStyle.Slide:
            m_TransitionAnimation.Replace(this, SlideIn());
            break;

        case AnimationStyle.Spin:
            m_TransitionAnimation.Replace(this, SpinIn());
            break;
        }
    }
        protected override void SetBasicStyles()
        {
            base.SetBasicStyles();

            int proportion = Convert.ToInt32(this.Element.Width / 30);

            var style = new Style(GetStyleName("loaderconfig"));

            style.Properties["border"]                    = $"{6*proportion}px solid #f3f3f3";
            style.Properties["border-top"]                = $"{6*proportion}px solid " + this.Element.Color.ToHTMLColor();
            style.Properties["border-radius"]             = "50%";
            style.Properties["position"]                  = "absolute";
            style.Properties["width"]                     = $"50%";
            style.Properties["height"]                    = $"50%";
            style.Properties["top"]                       = $"{Element.Margin.Top}";
            this.MainStyle.Properties["background-color"] = this.Element.BackgroundColor.ToHTMLColor();
            style.Properties["animation"]                 = $"{GetStyleName("spin")} 1s linear infinite";
            this.Styles.Add(style);

            //Add animation
            var spin = new AnimationStyle(GetStyleName("spin"));

            spin.Animations["0%"] = new Dictionary <string, string> {
                { "transform", "rotate(0deg)" }
            };
            spin.Animations["100%"] = new Dictionary <string, string> {
                { "transform", "rotate(360deg)" }
            };
            this.Styles.Add(spin);
        }
コード例 #3
0
        private Easing getEasing(AnimationStyle style)
        {
            switch (style)
            {
            default:
                return(Easing.None);

            case AnimationStyle.Accelerate1:
                return(Easing.In);

            case AnimationStyle.Accelerate2:
                return(Easing.InCubic);

            case AnimationStyle.Accelerate3:
                return(Easing.InQuint);

            case AnimationStyle.Gravity:
                return(Easing.InBack);

            case AnimationStyle.Decelerate1:
                return(Easing.Out);

            case AnimationStyle.Decelerate2:
                return(Easing.OutCubic);

            case AnimationStyle.Decelerate3:
                return(Easing.OutQuint);

            case AnimationStyle.InOut1:
                return(Easing.InOutCubic);

            case AnimationStyle.InOut2:
                return(Easing.InOutQuint);
            }
        }
コード例 #4
0
        private void ApplyAnimationStyle(AnimationStyle newValue)
        {
            int styleCacheIndex = (int)newValue;

            if (this.stylesCache[styleCacheIndex] == null)
            {
                Stream stream = typeof(RadBusyIndicator).GetTypeInfo().Assembly.GetManifestResourceStream("Telerik.UI.Xaml.Controls.Primitives." + newValue.ToString() + ".xaml");

                using (StreamReader reader = new StreamReader(stream))
                {
                    string styleText = reader.ReadToEnd();
                    this.stylesCache[styleCacheIndex] = XamlReader.Load(styleText) as Style;
                }
            }

            if (this.animation != null)
            {
                this.animation.Stop();
            }
            this.IndicatorAnimationStyle = this.stylesCache[styleCacheIndex];

            if (this.animation != null && this.CurrentVisualState == "Running")
            {
                this.animation.Start();
            }
        }
コード例 #5
0
 public void PlayOnce()
 {
     timer        = 0;
     currentFrame = 0;
     state        = AnimationState.kAnimPlaying;
     style        = AnimationStyle.kAnimPlayOnce;
 }
コード例 #6
0
        public void AnimationStyleInNameAndArgs()
        {
            var style = new AnimationStyle();

            style.Entry = "slide right";

            style.EntryName.Should().Be("slide");
            style.EntryArgs.Should().BeEquivalentTo(new[] { "right" });
        }
コード例 #7
0
        public void AnimationStyleStaticNameAndArgs()
        {
            var style = new AnimationStyle();

            style.Exit = "slide right 0.34 0.99";

            style.ExitName.Should().Be("slide");
            style.ExitArgs.Should().BeEquivalentTo(new[] { "right", "0.34", "0.99" });
        }
コード例 #8
0
        /// <summary>
        /// Get template of each attribute type
        /// it is used in TextRangeFindDialog.
        /// </summary>
        /// <returns></returns>
        public static IList <TemplateData> GetTemplate()
        {
            var boolList = new List <KeyValuePair <bool, string> >()
            {
                new KeyValuePair <bool, string>(false, "False"), new KeyValuePair <bool, string>(true, "True")
            };

            return(new List <TemplateData>
            {
                CreateTemplateData <int>(UIA_AnimationStyleAttributeId, AnimationStyle.GetInstance()),
                CreateTemplateData <int>(UIA_BackgroundColorAttributeId),
                CreateTemplateData <int>(UIA_BulletStyleAttributeId, BulletStyle.GetInstance()),
                CreateTemplateData <int>(UIA_CapStyleAttributeId, CapStyle.GetInstance()),
                CreateTemplateData <int>(UIA_CultureAttributeId, CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures).Select(c => new KeyValuePair <int, string>(c.LCID, c.EnglishName)).ToList()),
                CreateTemplateData <string>(UIA_FontNameAttributeId),
                CreateTemplateData <double>(UIA_FontSizeAttributeId),
                CreateTemplateData <int>(UIA_FontWeightAttributeId, FontWeight.GetInstance()),
                CreateTemplateData <int>(UIA_ForegroundColorAttributeId),
                CreateTemplateData <int>(UIA_HorizontalTextAlignmentAttributeId, HorizontalTextAlignment.GetInstance()),
                CreateTemplateData <int>(UIA_IndentationFirstLineAttributeId),
                CreateTemplateData <int>(UIA_IndentationLeadingAttributeId),
                CreateTemplateData <int>(UIA_IndentationTrailingAttributeId),
                CreateTemplateData <bool>(UIA_IsHiddenAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsItalicAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsReadOnlyAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsSubscriptAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsSuperscriptAttributeId, boolList),
                CreateTemplateData <int>(UIA_MarginBottomAttributeId),
                CreateTemplateData <int>(UIA_MarginLeadingAttributeId),
                CreateTemplateData <int>(UIA_MarginTopAttributeId),
                CreateTemplateData <int>(UIA_MarginTrailingAttributeId),
                CreateTemplateData <int>(UIA_OutlineStylesAttributeId, OutlineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_OverlineColorAttributeId),
                CreateTemplateData <int>(UIA_OverlineStyleAttributeId, TextDecorationLineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_StrikethroughColorAttributeId),
                CreateTemplateData <int>(UIA_StrikethroughStyleAttributeId, TextDecorationLineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_TabsAttributeId),
                CreateTemplateData <int>(UIA_TextFlowDirectionsAttributeId, FlowDirection.GetInstance()),
                CreateTemplateData <int>(UIA_UnderlineColorAttributeId),
                CreateTemplateData <int>(UIA_UnderlineStyleAttributeId, TextDecorationLineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_AnnotationTypesAttributeId, AnnotationType.GetInstance()),
                //CreateTemplateData<int>(UIA_AnnotationObjectsAttributeId, AnimationStyles.GetInstance()),
                CreateTemplateData <string>(UIA_StyleNameAttributeId),
                CreateTemplateData <int>(UIA_StyleIdAttributeId, StyleId.GetInstance()),
                //CreateTemplateData<int>(UIA_LinkAttributeId, AnimationStyles.GetInstance()),
                CreateTemplateData <bool>(UIA_IsActiveAttributeId, boolList),
                CreateTemplateData <int>(UIA_SelectionActiveEndAttributeId, ActiveEnd.GetInstance()),
                CreateTemplateData <int>(UIA_CaretPositionAttributeId, CaretPosition.GetInstance()),
                CreateTemplateData <int>(UIA_CaretBidiModeAttributeId, CaretBidiMode.GetInstance()),
                CreateTemplateData <string>(UIA_LineSpacingAttributeId),
                CreateTemplateData <double>(UIA_BeforeParagraphSpacingAttributeId),
                CreateTemplateData <double>(UIA_AfterParagraphSpacingAttributeId),
                CreateTemplateData <int>(UIA_SayAsInterpretAsAttributeId, SayAsInterpretAs.GetInstance()),
            });
        }
コード例 #9
0
        public SpriteAnimation(String anim_name, int num_frames, String anim_pattern, AnimationStyle anim_style)
        {
            int cur_pos, next_pos, len, cur_val;
            bool expecting_frame;

            // temporary queues for storing data while reading through the movestring
            Queue<int> frame_queue = new Queue<int>();
            Queue<int> wait_queue = new Queue<int>();

            name = anim_name;
            style = anim_style;
            _pattern = SpriteAnimation.clean_pattern(anim_pattern);
            len = _pattern.Length;
            transition_to = null;

            if (_pattern.Substring(0, 1) != SpriteAnimation.FRAME) throw new MalformedAnimationPatternException(_pattern, "Patterns must begin with \"F\"");
            cur_pos = 1;
            expecting_frame = false;
            while (cur_pos < len) {
                if (expecting_frame) next_pos = _pattern.IndexOf(SpriteAnimation.FRAME, cur_pos);
                else next_pos = _pattern.IndexOf(SpriteAnimation.WAIT, cur_pos);
                if (next_pos == -1) next_pos = len;
                try {
                    cur_val = Int32.Parse(_pattern.Substring(cur_pos, next_pos - cur_pos));
                }
                catch (Exception) {
                    throw new MalformedAnimationPatternException(_pattern, "Patterns must alternate between F# and W# terms, where each # is a positive integer.");
                }
                if (expecting_frame) {
                    //Console.WriteLine("Wait {0}", cur_val);
                    if (cur_val < 0) throw new MalformedAnimationPatternException(_pattern, "Negative wait specified.");
                    wait_queue.Enqueue(cur_val);
                }
                else {
                    //Console.WriteLine("Frame {0}", cur_val);
                    if (cur_val < 0) throw new MalformedAnimationPatternException(_pattern, "Negative frame specified.");
                    if (cur_val >= num_frames) throw new MalformedAnimationPatternException(_pattern, "Frame " + cur_val + " specified, but the sprite only has " + num_frames + " frames. Note that frames begin at 0.");
                    frame_queue.Enqueue(cur_val);
                }
                expecting_frame = !expecting_frame;
                cur_pos = next_pos + 1;
            }

            // It's legal not to specify the last frame's wait time. If it's left blank, give it a wait time of 1.
            if (wait_queue.Count < frame_queue.Count) wait_queue.Enqueue(1);

            length = frame_queue.Count;
            frame = new int[length];
            delay = new int[length];
            for (int i = 0; i < length; i++) {
                frame[i] = frame_queue.Dequeue();
                delay[i] = wait_queue.Dequeue();
            }
        }
コード例 #10
0
 public CharacterBehavior(CharacterRole role, string ownName)
 {
     Role                 = role;
     OwnName              = ownName;
     MyAction             = Action.Idle;
     MyDesire             = Desire.Nothing;
     MyAnimation          = AnimationStyle.Idle;
     InebriationLevel     = 0;
     LastDecisionDuration = float.PositiveInfinity;
     MovementSpeed        = 0;
 }
コード例 #11
0
        public void QueueAnimationP1(int animId, AnimationStyle inStyle)
        {
            if (numQueuedAnims >= (int)Enum.kMaxAnimsInQueue)
            {
                return;
            }

            Globals.Assert(numQueuedAnims < (int)Enum.kMaxAnimsInQueue);
            queuedAnim[numQueuedAnims]      = animId;
            queuedAnimStyle[numQueuedAnims] = (int)inStyle;
            numQueuedAnims++;
        }
コード例 #12
0
        public static LoadingLayoutBase createLoadingLayout(this AnimationStyle value, Context context, PullMode mode, ScrollOrientation scrollDirection, TypedArray attrs)
        {
            switch (value)
            {
            case AnimationStyle.ROTATE:
            default:
                return(new RotateLoadingLayout(context, mode, scrollDirection, attrs));

            case AnimationStyle.FLIP:
                return(new FlipLoadingLayout(context, mode, scrollDirection, attrs));
            }
        }
コード例 #13
0
 private bool TryAnimateWindow(bool value)
 {
     if (AnimationEnabled(value))
     {
         int            v     = value ? 1 : 0;
         AnimationStyle flags = (value ? AnimationStyle.AW_ACTIVATE : AnimationStyle.AW_HIDE)
                                | FormAnimationStyleToStyle[(int)_animationStyle[v]]
                                | FormAnimationDirectionToStyle[(int)_animationDirection[v]];
         return(AnimateWindow(Handle, _animationSpeedMSec[v], flags));
     }
     return(false);
 }
コード例 #14
0
        public void PlayAnimationP1(int animId, AnimationStyle inStyle)
        {
            Globals.Assert(animId < (int)Enum.kMaxAnimationsPerCharacter);
            if (inStyle == AnimationStyle.kAnimPlayOnce)
            {
                (anim[animId]).PlayOnce();
            }
            else
            {
                (anim[animId]).PlayLooping();
            }

            currentAnimId = animId;
        }
コード例 #15
0
ファイル: SpriteAnimation.cs プロジェクト: Gayo/XNAVERGE
        public SpriteAnimation( String anim_name, int num_frames, System.Collections.Generic.List<System.Object> anim_pattern, AnimationStyle anim_style )
        {
            name = anim_name;
            style = anim_style;
            length = anim_pattern.Count;
            transition_to = null;
            frame = new int[length];
            delay = new int[length];
            for( int i = 0; i < length; i++ ) {

                System.Collections.Generic.List<System.Object> item = (System.Collections.Generic.List<System.Object>)anim_pattern[i];

                frame[i] = (int)(System.Int64)item[0];
                delay[i] = (int)(System.Int64)item[1];
            }
        }
コード例 #16
0
        public Preloader(Control control, AnimationStyle style, AnimationSpeed speed,
                         Position position = Position.MiddleCenter)
        {
            this.control = control;
            if (control == null)
            {
                throw new NullReferenceException("control reference not set to an instance of Control");
            }
            //Make sure control is double buffered
            typeof(Control).InvokeMember("DoubleBuffered", BindingFlags.SetProperty |
                                         BindingFlags.Instance | BindingFlags.NonPublic, null, control, new object[] { true });
            control.BackgroundImageLayout = ImageLayout.Stretch;
            this.style    = style;
            this.speed    = speed;
            this.position = position;

            double timerInterval;

            switch (speed)
            {
            case AnimationSpeed.VerySlow:
                timerInterval = 500;
                break;

            case AnimationSpeed.Slow:
                timerInterval = 250;
                break;

            case AnimationSpeed.Fast:
                timerInterval = 50;
                break;

            case AnimationSpeed.VeryFast:
                timerInterval = 25;
                break;

            case AnimationSpeed.Medium:
            default:
                timerInterval = 100;
                break;
            }

            CreateFrames();
            this.originalBackgroundImage = control.BackgroundImage;
            timer          = new System.Timers.Timer(timerInterval);
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
        }
コード例 #17
0
        private void ApplyAnimationStyle(AnimationStyle newValue)
        {
            int styleCacheIndex = (int)newValue;

            if (this.stylesCache[styleCacheIndex] == null)
            {
                var resourceName = typeof(RadBusyIndicator).GetTypeInfo().Assembly.GetManifestResourceNames().Where(c => c.Contains(newValue.ToString())).First();

                Stream stream = typeof(RadBusyIndicator).GetTypeInfo().Assembly.GetManifestResourceStream(resourceName);

                using (StreamReader reader = new StreamReader(stream))
                {
                    string styleText = reader.ReadToEnd();
                    this.stylesCache[styleCacheIndex] = XamlReader.Load(styleText) as Style;
                }
            }

            this.IndicatorAnimationStyle = this.stylesCache[styleCacheIndex];
        }
コード例 #18
0
        private void ApplyAnimationStyle(AnimationStyle newValue)
        {
            int styleCacheIndex = (int)newValue;

            if (this.stylesCache[styleCacheIndex] == null)
            {
                var resourceName = typeof(RadBusyIndicator).GetTypeInfo().Assembly.GetManifestResourceNames().Where(c => c.Contains(newValue.ToString())).First();
//#if WINDOWS_UWP
//                Stream stream = typeof(RadBusyIndicator).GetTypeInfo().Assembly.GetManifestResourceStream("Telerik.UI.Xaml.Controls.Primitives.Shared.BusyIndicator.Animations." + newValue.ToString() + ".xaml");
//#else

                Stream stream = typeof(RadBusyIndicator).GetTypeInfo().Assembly.GetManifestResourceStream(resourceName);
//#endif
                using (StreamReader reader = new StreamReader(stream))
                {
                    string styleText = reader.ReadToEnd();
                    this.stylesCache[styleCacheIndex] = XamlReader.Load(styleText) as Style;
                }
            }

            this.IndicatorAnimationStyle = this.stylesCache[styleCacheIndex];
        }
コード例 #19
0
        private Easing getEasing(AnimationStyle style)
        {
            switch (style)
            {
            case AnimationStyle.Linear:
                return(Easing.None);

            case AnimationStyle.Gravity:
                return(Easing.InBack);

            case AnimationStyle.InOut1:
                return(Easing.InOutCubic);

            case AnimationStyle.InOut2:
                return(Easing.InOutQuint);

            case AnimationStyle.Accelerate1:
                return(Easing.In);

            case AnimationStyle.Accelerate2:
                return(Easing.InCubic);

            case AnimationStyle.Accelerate3:
                return(Easing.InQuint);

            case AnimationStyle.Decelerate1:
                return(Easing.Out);

            case AnimationStyle.Decelerate2:
                return(Easing.OutCubic);

            case AnimationStyle.Decelerate3:
                return(Easing.OutQuint);

            default:
                throw new ArgumentOutOfRangeException(nameof(style), style, @"Unsupported animation style");
            }
        }
コード例 #20
0
 public DataAnimAnalytics(AEPJsonFinal _jsonFinal, string _filename, AnimationStyle _animationStyle)
 {
     this.jsonFinal = _jsonFinal;
     this.filename  = _filename;
     animationStyle = _animationStyle;
 }
コード例 #21
0
 public PullToRefreshAdapterViewBase(Context context, PullMode mode, AnimationStyle animStyle) : base(context, mode, animStyle)
 {
     mRefreshableView.SetOnScrollListener(this);
 }
コード例 #22
0
        public void UpdateDecision()   // called once (and only once) per frame update
        // for the moment, we assume an endless party
        {
            GameObject      self = GameObject.Find(OwnName);
            GameObject      gso  = GameObject.Find("GameStateGlob"); //
            GameStateDetail gs   = gso.GetComponent <GameStateDetail>();

            float distanceToNearestGuest = getDistanceToNearest(self, "RandomGuest");
            float distanceToNearestBar   = getDistanceToNearest(self, "Bar");
            float distanceToNearestMusic = getDistanceToNearest(self, "BoomBox");
            float distanceToFrontDoor    = getDistanceToNearest(self, "FrontDoor");;

            if (LastDecisionDuration >= NormalDecisionDuration)
            {
                //
                // first handle desire
                //
                if (MyDesire == Desire.Nothing)
                {
                    List <Desire> possibleDesires;
                    LastDecisionDuration = 0f;
                    switch (Role)
                    {
                    case CharacterRole.RandomGuest:
                    case CharacterRole.LoveInterest:
                        if (gs.isMorning())
                        {
                            possibleDesires = new List <Desire>()
                            {
                                Desire.Leave
                            };
                        }
                        else
                        {
                            possibleDesires = new List <Desire>()
                            {
                                Desire.Drink, Desire.Dance, Desire.Talk
                            };
                            if (distanceToNearestGuest < NearDistance)
                            {
                                possibleDesires.Add(Desire.Talk);
                            }
                            if (distanceToNearestGuest < OkDistance)
                            {
                                possibleDesires.Add(Desire.Talk);
                            }
                            if (distanceToNearestBar < NearDistance)
                            {
                                possibleDesires.Add(Desire.Drink);
                            }
                            if (distanceToNearestBar < OkDistance)
                            {
                                possibleDesires.Add(Desire.Drink);
                            }
                            if (distanceToNearestMusic < NearDistance)
                            {
                                possibleDesires.Add(Desire.Dance);
                            }
                            if (distanceToNearestMusic < OkDistance)
                            {
                                possibleDesires.Add(Desire.Dance);
                            }
                            if (gs.isLate())
                            {
                                possibleDesires.Add(Desire.Leave);
                            }
                            if (gs.isLate())
                            {
                                possibleDesires.Add(Desire.Leave);
                            }
                            if (gs.isVeryLate())
                            {
                                possibleDesires.Add(Desire.Leave);
                            }
                            if (gs.isVeryLate())
                            {
                                possibleDesires.Add(Desire.Leave);
                            }
                            if (gs.isVeryLate())
                            {
                                possibleDesires.Add(Desire.Leave);
                            }
                            if (gs.isVeryLate())
                            {
                                possibleDesires.Add(Desire.Leave);
                            }
                        }
                        break;

                    default:
                        possibleDesires = new List <Desire>()
                        {
                            Desire.Nothing
                        };
                        break;
                    }
                    ;
                    int desireIndex = Random.Range(0, possibleDesires.Count);
                    MyDesire = possibleDesires[desireIndex];
                }
                ;
                //
                // change action based on desire
                //
                switch (MyDesire)
                {
                case Desire.Talk:
                    if (distanceToNearestGuest <= AdjacentDistance)
                    {
                        MyAction = Action.Conversation;
                        MyDesire = Desire.Nothing;
                    }
                    else
                    {
                        MyAction = Action.Seeking;
                        // TODO: add logic for choosing target
                    };
                    break;

                case Desire.Dance:
                    if (distanceToNearestBar <= NearDistance)
                    {
                        MyAction = Action.Dancing;
                        MyDesire = Desire.Nothing;
                    }
                    else
                    {
                        MyAction = Action.Seeking;
                        // TODO: add logic for choosing target
                    };
                    break;

                case Desire.Drink:
                    if (distanceToNearestBar <= AdjacentDistance)
                    {
                        MyAction = Action.Drinking;
                        MyDesire = Desire.Nothing;
                        // TODO: handle drink purchase
                    }
                    else
                    {
                        MyAction = Action.Seeking;
                        // TODO: add logic for choosing target
                    };
                    break;

                case Desire.Leave:
                    if (distanceToFrontDoor <= AdjacentDistance)
                    {
                        // TODO: handle "exit" of guest
                        MyAction = Action.Idle;
                        // we do NOT reset desire once the desire to leave starts
                    }
                    else
                    {
                        MyAction = Action.Seeking;
                        // TODO: add logic for choosing target
                    };
                    break;

                default:
                    MyAction = Action.Idle;
                    MyDesire = Desire.Nothing;
                    break;
                }
                //
                // change animation based on action
                //
                switch (MyAction)
                {
                case Action.Conversation:
                    MyAnimation   = AnimationStyle.Idle;
                    MovementSpeed = 0;
                    break;

                case Action.Seeking:
                    if (InebriationLevel >= 3)
                    {
                        MyAnimation   = AnimationStyle.MovingDrunk;
                        MovementSpeed = 2;
                    }
                    else
                    {
                        MyAnimation   = AnimationStyle.MovingSober;
                        MovementSpeed = 3;
                    }
                    break;

                case Action.Drinking:
                    MyAnimation   = AnimationStyle.Drinking;
                    MovementSpeed = 0;
                    break;

                case Action.MixingDrink:     // only done by bartender (if we make one)
                    MyAnimation   = AnimationStyle.Mixing;
                    MovementSpeed = 0;
                    break;

                case Action.Serving:     // only done by bartender (if we make one)
                    MyAnimation   = AnimationStyle.Serving;
                    MovementSpeed = 0;
                    break;

                case Action.Dancing:
                    MyAnimation   = AnimationStyle.Dancing;
                    MovementSpeed = 0;
                    break;

                case Action.Leaving:
                    if (gs.isMorning())
                    {
                        MyAnimation   = AnimationStyle.Running;
                        MovementSpeed = 7;
                    }
                    else
                    {
                        if (InebriationLevel >= 3)
                        {
                            MyAnimation   = AnimationStyle.MovingDrunk;
                            MovementSpeed = 2;
                        }
                        else
                        {
                            MyAnimation   = AnimationStyle.MovingSober;
                            MovementSpeed = 3;
                        }
                    }
                    break;

                case Action.Screaming:
                    MyAnimation   = AnimationStyle.Anger;
                    MovementSpeed = 0;
                    break;

                case Action.Flirting:     // Only done by player
                case Action.Cleaning:     // Only done by player
                    MyAnimation   = AnimationStyle.Idle;
                    MovementSpeed = 0;
                    break;

                default:
                    break;
                }
            }
            ;
            //
            //
            LastDecisionDuration += Time.deltaTime;
        }
コード例 #23
0
 // If the frame and delay array have already been generated (as is the case with sprites saved to file), this is the constructor
 // to use. It makes no effort to check that the pattern actually matches the animation arrays given.
 public SpriteAnimation(String anim_name, String anim_pattern, int[] frame_arr, int[] delay_arr, AnimationStyle anim_style)
 {
     name = anim_name;
     _pattern = anim_pattern;
     frame = frame_arr;
     delay = delay_arr;
     length = frame_arr.Length;
     style = anim_style;
     transition_to = null;
 }
コード例 #24
0
 private static extern bool AnimateWindow(IntPtr hWnd, UInt32 dwTimeMSec, AnimationStyle dwFlags);
        private List <TextAttributeViewModel> GetTextRangeAttributeKeyValuePair(TextRange tr, KeyValuePair <int, string> kv, bool collapse)
        {
            List <TextAttributeViewModel> list = new List <TextAttributeViewModel>();

            dynamic value = tr.GetAttributeValue(kv.Key);

            switch (kv.Key)
            {
            case TextAttributeType.UIA_AnimationStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnimationStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_BackgroundColorAttributeId:
            case TextAttributeType.UIA_ForegroundColorAttributeId:
            case TextAttributeType.UIA_OverlineColorAttributeId:
            case TextAttributeType.UIA_StrikethroughColorAttributeId:
            case TextAttributeType.UIA_UnderlineColorAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, string.Format("#{0:X8}", value)));
                }
                break;

            case TextAttributeType.UIA_BulletStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, BulletStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CapStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CapStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CultureAttributeId:
                if (value is int culture)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Invariant($"{CultureInfo.GetCultureInfo(culture).EnglishName} ({culture})")));
                }
                break;

            case TextAttributeType.UIA_StyleIdAttributeId:
            case TextAttributeType.UIA_SayAsInterpretAsAttributeId:
                // VT_I4
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, SayAsInterpretAs.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_FontNameAttributeId:
            case TextAttributeType.UIA_StyleNameAttributeId:
            case TextAttributeType.UIA_LineSpacingAttributeId:
                // VT_BSTR
                if (value is string)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value));
                }
                break;

            case TextAttributeType.UIA_FontSizeAttributeId:
            case TextAttributeType.UIA_IndentationFirstLineAttributeId:
            case TextAttributeType.UIA_IndentationLeadingAttributeId:
            case TextAttributeType.UIA_IndentationTrailingAttributeId:
            case TextAttributeType.UIA_MarginBottomAttributeId:
            case TextAttributeType.UIA_MarginLeadingAttributeId:
            case TextAttributeType.UIA_MarginTopAttributeId:
            case TextAttributeType.UIA_MarginTrailingAttributeId:
            case TextAttributeType.UIA_BeforeParagraphSpacingAttributeId:
            case TextAttributeType.UIA_AfterParagraphSpacingAttributeId:
                // VT_R8
                if (value is double || value is long)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString()));
                }
                break;

            case TextAttributeType.UIA_FontWeightAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_HorizontalTextAlignmentAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_IsHiddenAttributeId:
            case TextAttributeType.UIA_IsItalicAttributeId:
            case TextAttributeType.UIA_IsReadOnlyAttributeId:
            case TextAttributeType.UIA_IsSubscriptAttributeId:
            case TextAttributeType.UIA_IsSuperscriptAttributeId:
            case TextAttributeType.UIA_IsActiveAttributeId:
                if (value is bool)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString()));
                }
                break;

            case TextAttributeType.UIA_OutlineStylesAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, OutlineStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_OverlineStyleAttributeId:
            case TextAttributeType.UIA_StrikethroughStyleAttributeId:
            case TextAttributeType.UIA_UnderlineStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, TextDecorationLineStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_TabsAttributeId:
                var txt = ConvertArrayToString(value);

                if (txt != null)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, txt));
                }
                break;

            case TextAttributeType.UIA_TextFlowDirectionsAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FlowDirection.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_AnnotationTypesAttributeId:
                StringBuilder sb = new StringBuilder();
                if (value is double)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnnotationType.GetInstance().GetNameById((int)value)));
                }
                else if (value is Array arr)
                {
                    if (collapse && arr.Length > 0)     // collapse the array into a single row
                    {
                        var count = new Dictionary <string, int>();
                        foreach (var val in arr)
                        {
                            var key = AnnotationType.GetInstance().GetNameById((int)val);
                            if (count.ContainsKey(key))
                            {
                                count[key]++;
                            }
                            else
                            {
                                count[key] = 1;
                            }
                        }

                        StringBuilder strBuild = new StringBuilder();
                        foreach (var item in count)
                        {
                            strBuild.Append(Invariant($"{item.Key}: {item.Value}, "));
                        }
                        strBuild.Length -= 2;   //remove final , and <space>
                        list.Add(new TextAttributeViewModel(kv.Key, kv.Value, strBuild.ToString()));
                    }
                    else     // create a row for each array value
                    {
                        if (arr.Length > 0)
                        {
                            for (int i = 0; i < arr.Length; i++)
                            {
                                list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", kv.Value, i), AnnotationType.GetInstance().GetNameById((int)arr.GetValue(i))));
                            }
                        }
                    }
                }
                break;

            case TextAttributeType.UIA_SelectionActiveEndAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, ActiveEnd.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CaretPositionAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretPosition.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CaretBidiModeAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretBidiMode.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_AnnotationObjectsAttributeId:
                if (value is IUIAutomationElementArray)
                {
                    IUIAutomationElementArray arr = value;
                    if (arr.Length > 0)
                    {
                        for (int i = 0; i < arr.Length; i++)
                        {
                            list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, Resources.TextRangeViewModel_GetTextRangeAttributeKeyValuePair_AnnotationObjects_0, i), new DesktopElement((IUIAutomationElement)arr.GetElement(i))));
                        }
                    }
                }
                break;

            case TextAttributeType.UIA_LinkAttributeId:
                // do nothing for now until it is shown as necessary information.
                //try
                //{
                //    IUIAutomationTextRange lnk = Marshal.GetObjectForIUnknown(value) as IUIAutomationTextRange;
                //    list.Add(new TextAttributeViewModel(kv.Value, new TextRangeViewModel(new TextRange(lnk))));
                //}
                //catch (Exception e)
                //{
                //    e.ReportException();
                //}
                break;

            default:
                // need to make a decision for these Attributes since it return Object.
                if (value.GetType().Name != "__ComObject")
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value));
                }
                break;
            }

            return(list);
        }
 public PullToRefreshHorizontalScrollView(Context context, PullMode mode, AnimationStyle style) : base(context, mode, style)
 {
 }
コード例 #27
0
        private void MBeign(AnimationStyle style, Sprite tempViewSprite = null, Sprite backgroundSprite = null)
        {
            if (repeatedCalls == true)
            {
                repeatedCalls = null;
                BasicSetup();
                if (tempViewSprite != null)
                {
                    tempView.sprite = tempViewSprite;
                }
                else
                {
                    tempView.sprite = sprite;
                }

                if (backgroundSprite != null)
                {
                    backgroundImage.sprite = backgroundSprite;
                }
                else
                {
                    backgroundImage.sprite = background;
                }

                StopAllCoroutines();
                switch (style)
                {
                case AnimationStyle.Rotation:
                    if (m_tempNumbText)
                    {
                        Destroy(m_tempNumbText.gameObject);
                    }
                    m_tempView.type = IMCImage.Type.Simple;
                    StartCoroutine(RotationCoroutine());
                    break;

                case AnimationStyle.NumbCircularProgressBar:
                    ProgressBar(IMCUI.UI.IMCImage.FillMethod.Radial360, true);
                    break;

                case AnimationStyle.NumbSquareProgressBar:
                    if (!isTempViewCustomSize)
                    {
                        tempView.sizeDelta = targetRT.sizeDelta;
                    }
                    ProgressBar(IMCUI.UI.IMCImage.FillMethod.Horizontal, true);
                    break;

                case AnimationStyle.CircularProgressBar:
                    if (m_tempNumbText)
                    {
                        Destroy(m_tempNumbText.gameObject);
                    }
                    ProgressBar(IMCUI.UI.IMCImage.FillMethod.Radial360, false);
                    break;

                case AnimationStyle.SquareProgressBar:
                    if (m_tempNumbText)
                    {
                        Destroy(m_tempNumbText.gameObject);
                    }
                    if (!isTempViewCustomSize)
                    {
                        tempView.sizeDelta = targetRT.sizeDelta;
                    }
                    ProgressBar(IMCUI.UI.IMCImage.FillMethod.Horizontal, false);
                    break;
                }
                tempViewSize     = tempView.sizeDelta;
                tempViewPosition = tempView.anchoredPosition3D;

                targetRT.anchorMax = targetRtAnchorMax;
                targetRT.anchorMin = targetRtAnchorMin;
            }
            else if (repeatedCalls == null)
            {
                repeatedCalls = true;
                value         = 0;
                MBeign(style);
            }
        }
コード例 #28
0
 public void Begin(AnimationStyle style, Sprite tempViewSprite = null, Sprite backgroundSprite = null)
 {
     animationStyle = style;
     MBeign(animationStyle, tempViewSprite, background);
 }
コード例 #29
0
ファイル: CallOutText.cs プロジェクト: WalterTS/PernodApp
        /// <summary>
        /// Build a callout text, currently it only supports two animation styles, which are Translate & Scale and Translate & Rotate.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="fontSize"></param>
        /// <param name="duration"></param>
        /// <param name="animStyle"></param>
        /// <param name="parent"></param>
        /// <param name="worldTransformPosition"></param>
        public CallOutText(string text, Font font, int fontSize, Color textColor, float duration, AnimationStyle animStyle = AnimationStyle.TRANSLATE_AND_SCALE, float yTranslation = 10f, RectTransform parent = null, Vector3 worldTransformPosition = new Vector3())
        {
            _displayObject = new GameObject("callOutText");

            _animateComponent     = _displayObject.AddComponent <AnimateComponent>();
            _textComponent        = _displayObject.AddComponent <Text>();
            _textOutlineComponent = _displayObject.AddComponent <Outline>();

            _textComponent.font               = font;
            _textComponent.text               = text;
            _textComponent.verticalOverflow   = VerticalWrapMode.Overflow;
            _textComponent.horizontalOverflow = HorizontalWrapMode.Overflow;
            _textComponent.alignment          = TextAnchor.MiddleCenter;
            _textComponent.fontSize           = fontSize;

            _textOutlineComponent.effectDistance = new Vector2(3, -3);

            if (parent == null)
            {
                parent = _displayObject.transform.GetMainCanvas().GetComponent <RectTransform>();
            }

            _displayObject.transform.SetParent(parent);

            // Convert worldTransformPosition into UI canvas position
            Vector2 viewportPosition   = Camera.main.WorldToViewportPoint(worldTransformPosition);
            Vector3 anchored3DPosition = new Vector3(
                ((viewportPosition.x * parent.rect.width) - (parent.rect.width * 0.5f)),
                ((viewportPosition.y * parent.rect.height) - (parent.rect.height * 0.5f)),
                0
                );

            // Clean weird transform when setting parent.
            _displayObject.transform.localPosition = anchored3DPosition;
            _displayObject.transform.localRotation = animStyle == AnimationStyle.TRANSLATE_AND_ROTATE ? Quaternion.Euler(new Vector3(90f, 0, 180f)) : Quaternion.identity;
            _displayObject.transform.localScale    = animStyle == AnimationStyle.TRANSLATE_AND_SCALE ? new Vector3(0.1f, 0.1f, 0.1f) : new Vector3(1, 1, 1);

            color = textColor;

            Action onAnimFinish = delegate { _animateComponent.InterpolateColor(color, new Color(color.r, color.g, color.b, 0), duration * 0.4f, delegate { color = animateComponent.interpolatedColor; }, delegate { GameObject.Destroy(_displayObject); }); };

            anchored3DPosition.y += yTranslation;

            _animateComponent.TranslateObject(anchored3DPosition, duration * 0.6f, delegate { onAnimFinish(); });

            if (animStyle == AnimationStyle.TRANSLATE_AND_SCALE)
            {
                _animateComponent.ScaleObject(new Vector3(1f, 1f, 1f), duration * 0.6f, null);
            }
            else if (animStyle == AnimationStyle.TRANSLATE_AND_ROTATE)
            {
                _animateComponent.RotateObject(new Vector3(), duration * 0.6f, null);
            }
        }
コード例 #30
0
 public PullToRefreshGridView(Context context, PullMode mode, AnimationStyle style) : base(context, mode, style)
 {
 }
 public PullToRefreshExpandableListView(Context context, PullMode mode, AnimationStyle style) : base(context, mode, style)
 {
 }
コード例 #32
0
        }                                                   ///@property(readwrite,assign) GapType gapType;

        public void SetStyle(AnimationStyle inThing)
        {
            style = inThing;
        }                                                      ///@property(readwrite,assign) AnimationStyle style;
コード例 #33
0
        public DetailView()
        {
            this.Title = "Firework";

            MessagingCenter.Subscribe <MasterViewModel, int>(this, Constants.MC_TOPIC_TILE_COUNT_UPDATED, (sender, arg) => {
                _gridsize = arg;
            });
            MessagingCenter.Subscribe <MasterViewModel, int>(this, Constants.MC_TOPIC_TILE_SIZE_UPDATED, (sender, arg) => {
                _tileSize = arg;
            });
            MessagingCenter.Subscribe <MasterViewModel, AnimationStyle>(this, Constants.MC_TOPIC_ANIMATION_STYLE_UPDATED, (sender, arg) => {
                _selectedAnimation = arg;
            });

            _vm = new DetailViewModel();
            _vm.BeforeFireworkChange += OnBeforeFireworkChange;
            _vm.PropertyChanged      += VMPropertyChanged;
            this.BindingContext       = _vm;

            _layout = new StackLayout()
            {
                Orientation     = StackOrientation.Vertical,
                BackgroundColor = Color.DarkSlateGray
            };

            _title = new Label()
            {
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, 100, 0, 0),
                FontSize          = 22,
                FontAttributes    = FontAttributes.Bold,
                TextColor         = Color.White
            };
            _title.SetBinding(Label.TextProperty, "Firework.Name");
            _layout.Children.Add(_title);

            RepaintTiledImageView();

            _description = new Label()
            {
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(25),
                FontSize          = 14,
                TextColor         = Color.WhiteSmoke
            };
            _description.SetBinding(Label.TextProperty, "Firework.Description");
            _layout.Children.Add(_description);

            var nextButton = new Button()
            {
                Text = "Next",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.EndAndExpand,
                Margin            = new Thickness(0, 0, 0, 25),
                TextColor         = Color.White
            };

            nextButton.SetBinding(Button.CommandProperty, "NextCommand");
            _layout.Children.Add(nextButton);

            var scrollview = new ScrollView();

            scrollview.Content = _layout;

            Content = scrollview;
        }