예제 #1
0
 void TextArea_MouseHover(object sender, MarginEventArgs e)
 {
     if (!drawer.AutoHide)
     {
         return;
     }
     if (e.Margin == editor.TextViewMargin)
     {
         StartFadeOutAnimation();
     }
     else
     {
         if (drawer.FoldMarkerOcapitiy >= 1)
         {
             return;
         }
         if (animationStage.Contains(this))
         {
             if (fadeIn)
             {
                 return;
             }
             animationStage.Exeunt();
         }
         fadeIn = true;
         animationStage.Add(this, FadeInTimer, drawer.FoldMarkerOcapitiy);
         animationStage.Play();
     }
 }
예제 #2
0
        private void Pack(Widget widget, uint duration, Easing easing, Blocking blocking, bool end)
        {
            if (widget == null)
            {
                throw new ArgumentNullException("widget");
            }

            AnimatedWidget animated_widget = new AnimatedWidget(widget, duration, easing, blocking, horizontal);

            animated_widget.Parent           = this;
            animated_widget.WidgetDestroyed += OnWidgetDestroyed;
            stage.Add(animated_widget, duration);
            animated_widget.Node = end
                ? children.AddLast(animated_widget)
                : children.AddFirst(animated_widget);

            RecalculateSpacings();
            if (active_count == 0)
            {
                if (border_state == AnimationState.Going)
                {
                    border_bias = Percent;
                }
                else
                {
                    border_easing = easing;
                    border_bias   = 1.0;
                }
                border_state = AnimationState.Coming;
                border_stage.Reset((uint)(duration * border_bias));
            }
            active_count++;
        }
예제 #3
0
        public static void Solve(TextReader input, TextWriter output)
        {
            int t = Convert.ToInt32(input.ReadLine());

            for (int z = 1; z <= t; z++)
            {
                string[] data = input.ReadLine().Split(' ');
                int      n    = Int32.Parse(data[0]);
                int      m    = Int32.Parse(data[1]);

                var stage = new Stage(n);

                for (int i = 0; i < m; i++)
                {
                    stage.Add(Model.Parse(input.ReadLine()));
                }

                stage.Improve();

                output.WriteLine("Case #{0}: {1} {2}", z, stage.Score, stage.Moves.Count);

                foreach (Model model in stage.Moves)
                {
                    output.WriteLine(model);
                }
            }
        }
예제 #4
0
        public static void Main(string[] args)
        {
            Application.Init();

            Stage stage = Stage.Default as Stage;

            (stage as Stage).KeyPressEvent += delegate {
                Clutter.Main.Quit();
            };

            // fixme: add constructor
            Clutter.Color stage_color = new Clutter.Color(0xcc, 0xcc, 0xcc, 0xff);
            stage.SetColor(stage_color);

            Clutter.Group group = new Group();
            stage.Add(group);
            group.Show();

            // Make a hand
            Clutter.Actor hand = new Texture("redhand.png");
            hand.SetPosition(0, 0);
            hand.Show();

            // Make a rect
            Clutter.Rectangle rect = new Clutter.Rectangle();
            rect.SetPosition(0, 0);
            rect.SetSize((int)hand.Width, (int)hand.Height);

            Clutter.Color rect_bg_color = new Clutter.Color(0x33, 0x22, 0x22, 0xff);
            rect.SetColor(rect_bg_color);
            rect.BorderWidth = 10;
            rect.Show();

            group.Add(rect);
            group.Add(hand);

            // Make a timeline
            Timeline timeline = new Timeline(100, 26);

            timeline.Loop = true;

            Alpha alpha = new Alpha(timeline, (a) => a.Value);

            Behaviour o_behave = new BehaviourOpacity(alpha, 0x33, 0xff);

            o_behave.Apply(group);

            // Make a path behaviour and apply that too
            Behaviour p_behave = new BehaviourPath(alpha, knots);             // fixme: add custom constructor?

            p_behave.Apply(group);

            // start timeline
            timeline.Start();

            stage.ShowAll();

            // launch
            Application.Run();
        }
예제 #5
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.transform != target)
        {
            return;
        }
        Destroy(collision.gameObject);
        if (destructionEffectPrefab)
        {
            Stage.Add(destructionEffectPrefab, collision.transform.position, collision.transform.rotation);
        }

        var renderer = GetComponent <Renderer>();

        renderer.enabled = false;

        float time  = 0f;
        var   trail = GetComponent <TrailRenderer>();

        if (trail)
        {
            time = trail.time;
        }
        Destroy(gameObject, time);

        Sound.Play("hit", transform.position);
    }
예제 #6
0
        void RemoveCore(AnimatedWidget widget, uint duration, Easing easing, Blocking blocking, bool use_easing, bool use_blocking)
        {
            if (duration > 0)
            {
                widget.Duration = duration;
            }

            if (use_easing)
            {
                widget.Easing = easing;
            }

            if (use_blocking)
            {
                widget.Blocking = blocking;
            }

            if (widget.AnimationState == AnimationState.Coming)
            {
                widget.AnimationState = AnimationState.IntendingToGo;
            }
            else
            {
                if (widget.Easing == Easing.QuadraticIn)
                {
                    widget.Easing = Easing.QuadraticOut;
                }
                else if (widget.Easing == Easing.QuadraticOut)
                {
                    widget.Easing = Easing.QuadraticIn;
                }
                else if (widget.Easing == Easing.ExponentialIn)
                {
                    widget.Easing = Easing.ExponentialOut;
                }
                else if (widget.Easing == Easing.ExponentialOut)
                {
                    widget.Easing = Easing.ExponentialIn;
                }
                widget.AnimationState = AnimationState.Going;
                stage.Add(widget, widget.Duration);
            }

            duration = widget.Duration;
            easing   = widget.Easing;
        }
        protected void SetupLabels()
        {
            caption_cover = new CoverCaption(cover_manager, "Sans Bold 10", new Clutter.Color(1.0f, 1.0f, 1.0f, 1.0f));
            Stage.Add(caption_cover);

            caption_track = new TrackCaption(cover_manager, "Sans Bold 10", new Clutter.Color(1.0f, 1.0f, 1.0f, 1.0f));
            Stage.Add(caption_track);
        }
예제 #8
0
    IEnumerator _AddBullet(Alphabet alphabet, float delay)
    {
        yield return(new WaitForSeconds(delay));

        var obj    = Stage.Add(bulletPrefab, transform.position, Quaternion.identity) as GameObject;
        var bullet = obj.GetComponent <Bullet>();

        bullet.target = alphabet.transform;
    }
예제 #9
0
    static void Main()
    {
        Clutter.Application.Init();

        Stage stage = Stage.Default;

        stage.SetSize(800, 600);
        stage.SetColor(new Clutter.Color(0x61, 0x64, 0x8c, 0xff));

        SuperOH oh = new SuperOH();

        CurrentOH = oh;
        oh.Group  = new Group();
        oh.Hands  = new Actor[n_hands];

        for (int i = 0; i < n_hands; i++)
        {
            Texture hand_text = new Texture("redhand.png");
            uint    w         = hand_text.Width;
            uint    h         = hand_text.Height;

            uint radius = GetRadius();

            oh.Hands[i] = hand_text;

            int x = (int)(stage.Width / 2
                          + radius
                          * Math.Cos(i * Math.PI / (n_hands / 2))
                          - w / 2);
            int y = (int)(stage.Height / 2
                          + radius
                          * Math.Sin(i * Math.PI / (n_hands / 2))
                          - h / 2);

            oh.Hands[i].SetPosition(x, y);

            oh.Group.Add(oh.Hands[i]);
        }

        oh.Group.ShowAll();
        stage.Add(oh.Group);
        stage.ButtonPressEvent += HandleButtonPress;
        stage.KeyPressEvent    += HandleKeyPress;

        stage.ShowAll();

        Timeline timeline = new Timeline(360, 90);

        timeline.Loop      = true;
        timeline.NewFrame += HandleNewFrame;
        timeline.Start();

        Clutter.Application.Run();
    }
        protected void SetupWidgetBar()
        {
            pm_button   = new PartyModeButton();
            fs_button   = new FullscreenButton();
            sort_button = new SortButton();

            widget_bar = new ClutterWidgetBar(new Actor[] { pm_button, fs_button, sort_button });
            widget_bar.ShowAll();
            Stage.Add(widget_bar);
            widget_bar.SetPosition(5, 5);
        }
예제 #11
0
        public virtual void Start()
        {
            if (Stage.Contains(this))
            {
                Actor.Reset(Duration);
                return;
            }

            Actor           = Stage.Add(this, Duration);
            IsExpired       = false;
            Actor.CanExpire = false;
        }
예제 #12
0
        public void TestSelectedChangedWhenItemWhichIsSelected()
        {
            var stage        = new Stage();
            var sceneEntity1 = Mock.Of <ISceneEntity>();

            stage.Add(sceneEntity1);
            var sceneEntity2 = Mock.Of <ISceneEntity>();

            stage.Add(sceneEntity2);
            _sceneContent.Stage = stage;
            _sceneContent.SetSelectedItems(new List <ISceneEntity> {
                sceneEntity1, sceneEntity2
            });
            ClearSelectedSceneElementsResult();

            _sceneContent.Stage.Remove(sceneEntity1);

            Assert.IsTrue(_selectedSceneEntitiesEventFired);
            CollectionAssert.DoesNotContain(_sceneContent.SelectedItems, sceneEntity1);
            CollectionAssert.Contains(_sceneContent.SelectedItems, sceneEntity2);
        }
예제 #13
0
    void Generate()
    {
        var pos = randomPosition;

        if (enemyPrefab)
        {
            var obj   = Stage.Add(enemyPrefab, pos, Quaternion.Euler(0f, 180f, 0f));
            var enemy = obj.GetComponent <Enemy>();
            enemy.angVelocity = new Vector3(0, 0, Random.Range(-5f, 5f));
            enemy.word        = randomWord;
        }
    }
예제 #14
0
 void StartFadeInAnimation()
 {
     if (!drawer.AutoHide)
     {
         return;
     }
     if (drawer.FoldMarkerOcapitiy >= 1)
     {
         return;
     }
     if (animationStage.Contains(this))
     {
         if (fadeIn)
         {
             return;
         }
         animationStage.Exeunt();
     }
     fadeIn = true;
     animationStage.Add(this, FadeInTimer, drawer.FoldMarkerOcapitiy);
     animationStage.Play();
 }
        protected void SetupViewport()
        {
            Stage.Color = new Clutter.Color(0x00, 0x00, 0x00, 0xff);
            cover_manager.SetRotation(RotateAxis.X, viewportAngleX, Stage.Width / 2, Stage.Height / 2, 0);
            Stage.Add(cover_manager);

            cover_manager.EmptyActor.SetToPb(
                IconThemeUtils.LoadIcon(cover_manager.TextureSize, "gtk-stop", "clutterflow-large.png")
                );
            CoverManager.DoubleClickTime = (uint)Gtk.Settings.GetForScreen(this.Screen).DoubleClickTime;
            cover_manager.LowerBottom();
            cover_manager.Show();
        }
        public void Start()
        {
            if (Stage.Contains(this))
            {
                Actor.Reset();
                return;
            }

            Actor   = Stage.Add(this, Duration);
            Percent = 0;
            //iterations = 0;
            Actor.CanExpire = false;
        }
예제 #17
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            backgrounds = new List <Sprite>();
            sprite      = Content.Load <Texture2D>("Sprites/Tilemap");

            treelog = Content.Load <Texture2D>("Sprites/blockage64x12");

            tree = Content.Load <Texture2D>("Sprites/tree");

            treelogs = new List <Sprite>();
            trees    = new List <Sprite>();

            for (int i = 0; i < 20; i++)
            {
                backgrounds.Add(new Sprite(sprite));
                backgrounds[i].Position = new Vector2(0, i * sprite.Height);
            }

            for (int i = 0; i < 100; i++)
            {
                trees.Add(new Sprite(tree));
                trees[i].Position = new Vector2(500 + (800 * (i % 2)), i * 150);
                treelogs.Add(new Sprite(treelog));
                treelogs[i].Position  = new Vector2(1920 / 2 - (704) + (600 * (i % 2)), 2000 + (i * 400));
                treelogs[i].Rectangle = new Rectangle((int)treelogs[i].Position.X, (int)treelogs[i].Position.Y, treelog.Width, treelog.Height);
            }

            player    = new Player(Content.Load <Texture2D>("Sprites/skier64x96"), new Vector2(1920 / 2, 1080 / 2), this);
            playStage = new Stage();

            playStage.Add(backgrounds);
            playStage.Add(treelogs);
            playStage.Add(trees);
            playStage.Add(player);
            // TODO: use this.Content to load your game content here
        }
예제 #18
0
 public void AddToStage()
 {
     if (SelectedPatient != null)
     {
         PatientPrescriptionRenewalDisplayModel Item = new PatientPrescriptionRenewalDisplayModel
         {
             PatientId      = SelectedPatient.PatientId,
             FirstName      = SelectedPatient.FirstName,
             LastName       = SelectedPatient.LastName,
             PhoneNumber    = SelectedPatient.PhoneNumber,
             PrescriptionId = SelectedPatient.PrescriptionId,
             DrugName       = SelectedPatient.DrugName,
             RenewalDate    = SelectedPatient.RenewalDate
         };
         Stage.Add(Item);
         Patients.Remove(SelectedPatient);
         NotifyOfPropertyChange(() => CanAddToStage);
     }
 }
예제 #19
0
    public Bullet QueryBullet(Enemy enemy)
    {
        enemy.LockOn();
        var alphabet = enemy.OnAttack(key.ToString());

        if (alphabet)
        {
            Sound.Play("press1", transform.position);
            var obj = Stage.Add(bulletPrefab, transform.position, Quaternion.identity) as GameObject;
            bullets_.Add(obj);
            obj.transform.parent = transform;
            var bullet = obj.GetComponent <Bullet>();
            bullet.target = alphabet.transform;
            obj.SetActive(false);
            return(bullet);
        }
        else
        {
            Sound.Play("press5", transform.position);
        }

        return(null);
    }
 protected void SetupSlider()
 {
     slider = new ClutterFlowSlider(400, 40, cover_manager);
     Stage.Add(slider);
 }
예제 #21
0
        public void TestAddEntity()
        {
            var sceneEntity = new CubeEntity();

            _stage.Add(sceneEntity);
        }
예제 #22
0
파일: Deal.cs 프로젝트: hbons/Deal
    static void Main()
    {
        Clutter.Application.Init ();

        Stage = new Stage ();
        Stage.Title = "Deal!";
        Stage.Add (new Texture ("Pixmaps/Table.png"));
        Stage.SetSize (800, 480);
        Stage.KeyPressEvent += HandleKeyPress;

        Texture C = new Texture ("Pixmaps/Coin.png");
        C.SetSize (50, 50);
        C.SetPosition (35, 405);
        Stage.Add (C);

        Bet = 0;
        BetButton = new BetButton ();
        BetButton.ButtonPressEvent += IncreaseBet;
        Stage.Add (BetButton);

        DealButton = new DealButton ();
        DealButton.ButtonPressEvent += NewGame;
        Stage.Add (DealButton);

        StepButton = new StepButton ();
        StepButton.ButtonPressEvent += NextStep;
        Stage.Add (StepButton);

        Stack = new Stack ();
        Stack.Decrease (20);
        ScoreText = new Text ("Droid Sans Bold 21", "" + Stack.GetAmount());
        ScoreText.SetColor (new Clutter.Color (0xff, 0xff, 0xff, 0xff));
        ScoreText.SetPosition (100, 413);
        Stage.Add (ScoreText);

        Coins = new Coin [5];
        Coins [0] = new Coin ();
        Coins [1] = new Coin ();
        Coins [2] = new Coin ();
        Coins [3] = new Coin ();
        Coins [4] = new Coin ();
        for (int i = 0; i < 5; i++) {
            Coins [i].SetPosition (35, 405);
            Stage.Add (Coins [i]);
        }

        Deck = new Deck ();

        PlayerHand   = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ());
        OpponentHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ());

        SetupAnimation ();

        Stage.ShowAll();

        Clutter.Application.Run ();
    }