コード例 #1
0
ファイル: Radial.cs プロジェクト: wtf42/VSGraphVis
        public Radial(Graph<Object> G, int W, int H)
        {
            this.G = G;
            this.W = W;
            this.H = H;

            layout = new Layout(W, H);
        }
コード例 #2
0
ファイル: Base.cs プロジェクト: Jeinzi/Rectangle-Game
        /******** Functions ********/

        /// <summary>
        /// Creates a new base.
        /// </summary>
        /// <param name="rectangle">The rectangle representing the outer boundary of the base.</param>
        public Base(Rectangle rectangle)
        {
            health = 1000;
            layout = new Layout.Layout(Brushes.Transparent);

            // Adding outer part of base.
            outerBase                  = new Layout.Box("outerBase");
            outerBase.area             = rectangle;
            outerBase.fill             = new SolidBrush(Color.FromArgb(255, 50, 50, 50));
            outerBase.borderLine.Width = 3;
            layout.AddBox(outerBase);

            // Adding inner part of base.
            innerBase                  = new Layout.Box("innerBase");
            innerBase.parent           = outerBase;
            innerBase.percentageSize   = new Size(50, 50);
            innerBase.anchor           = Layout.Anchor.Center;
            innerBase.fill             = Brushes.Gray;
            outerBase.borderLine.Width = 3;
            layout.AddBox(innerBase);
        }
コード例 #3
0
ファイル: HV.cs プロジェクト: wtf42/VSGraphVis
        public List<List<Vector>> system_config(int W, int H,
                                         Graph<Object> G,
                                         out List<Vector> config,
                                         int root = -1, int p_root = -1,
                                         List<Vector> initial_config = null)
        {
            Layout layout = new Layout(W, H);

            HV hv = new HV();
            List<Vector> X = hv.system_config(G, root, p_root);

            Vector lt = new Vector(0,0), rb = new Vector(0,0);
            layout.getRect(ref X, ref lt, ref rb);

            for (int i = 0; i < X.Count; i++)
                X[i] = layout.getCoord(X[i], lt, rb);

            List<List<Vector>> _X = new List<List<Vector>>();
            _X.Add(X);

            config = X;

            return _X;
        }
コード例 #4
0
 // this is overrideen by children to updat their own controls colors
 protected virtual void DoChildAppearance(Layout.AppearanceClass app)
 {
 }
コード例 #5
0
        /// <summary>
        /// Saves the appearance. Triggered from callback in AppearancePanel itself, passing itself back to be stored in the database.
        /// </summary>
        /// <param name='obj'>
        /// Object.
        /// </param>
        void SaveAppearance(Layout.AppearanceClass obj)
        {
            if (null == obj)
                throw new Exception ("A null appearance was passed into save routine.");
            if (obj.Name == Constants.BLANK)
                throw new Exception ("A name must be assigned to any new Appearance that is created!");
            BaseDatabase db = CreateDatabase ();

            Store (db, obj.Name, obj.GetAppearanceXML (), 1);
            db.Dispose ();

            // the moment we save an appearance I think we need to PURGE the Cahce in LayoutDetails
            // so that the NEXT time a page is loaded, it benefits from the new appearnces (likewise if a new note is created).
            LayoutDetails.Instance.PurgeAppearanceCache ();
            if (null != Appearances) {
                // deselect on the list
                Appearances.SelectedIndex = -1;

                // we rebuild the list in case we added a new one
                BuildAppearanceListBox (Appearances);
            }
        }
コード例 #6
0
ファイル: LevelState.cs プロジェクト: Jeinzi/Rectangle-Game
        /******** Functions ********/

        public LevelState(GameStateManager gameStateManager)
        {
            // Randomize using ticks.
            random = new Random((int)DateTime.Now.Ticks);

            this.gameStateManager = gameStateManager;
            firstBlood            = false;
            victory        = false;
            stopwatch      = new Stopwatch();
            entities       = new List <Entity.Entity>();
            map            = new Map.Map(Program.mainForm.ClientSize.Width / 4 * 3, Program.mainForm.ClientSize.Height / 4 * 3);
            map.position.X = Program.mainForm.ClientSize.Width / 2 - map.size.Width;
            map.position.Y = Program.mainForm.ClientSize.Height / 2 - map.size.Height;

            layout = new Layout.Layout();
            layout.backgroundBrush = Brushes.Transparent;

            Layout.Box statusBox = new Layout.Box("statusBox");
            statusBox.percentageWidth    = 10;
            statusBox.percentageHeight   = 20;
            statusBox.percentageLocation = new PointF(89, 12.5f);

            // Redefining textbox standards.
            Textbox.SaveDefaultStyle();
            Textbox.defaultAnchor     = Anchor.Left;
            Textbox.defaultBorderline = Pens.Transparent;
            Textbox.defaultFill       = Brushes.Transparent;

            // Labels.
            Textbox timerLabel        = new Layout.Textbox("timerLabel");
            Textbox shotCounterLabel  = new Layout.Textbox("shotCounterLabel");
            Textbox enemyCounterLabel = new Layout.Textbox("enemyCounterLabel");
            Textbox scoreCounterLabel = new Layout.Textbox("scoreCounterLabel");

            timerLabel.parent             = statusBox;
            shotCounterLabel.parent       = statusBox;
            enemyCounterLabel.parent      = statusBox;
            scoreCounterLabel.parent      = statusBox;
            timerLabel.percentageY        = 5;
            shotCounterLabel.percentageY  = 30;
            enemyCounterLabel.percentageY = 55;
            scoreCounterLabel.percentageY = 80;
            timerLabel.text        = "Time:";
            shotCounterLabel.text  = "Shots:";
            enemyCounterLabel.text = "Hits:";
            scoreCounterLabel.text = "Score:";

            // Infoboxes.
            Textbox.defaultAnchor = Anchor.Right;

            Textbox timer        = new Textbox("timer");
            Textbox shotCounter  = new Textbox("shotCounter");
            Textbox enemyCounter = new Textbox("enemyCounter");
            Textbox scoreCounter = new Textbox("scoreCounter");

            timer.parent             = statusBox;
            shotCounter.parent       = statusBox;
            enemyCounter.parent      = statusBox;
            scoreCounter.parent      = statusBox;
            timer.percentageY        = timerLabel.percentageY;
            shotCounter.percentageY  = shotCounterLabel.percentageY;
            enemyCounter.percentageY = enemyCounterLabel.percentageY;
            scoreCounter.percentageY = scoreCounterLabel.percentageY;

            Textbox.RestoreDefaultStyle();

            // Adding boxes to layout.
            layout.AddBox(statusBox);
            layout.AddBox(timer);
            layout.AddBox(timerLabel);
            layout.AddBox(shotCounter);
            layout.AddBox(shotCounterLabel);
            layout.AddBox(enemyCounter);
            layout.AddBox(enemyCounterLabel);
            layout.AddBox(scoreCounter);
            layout.AddBox(scoreCounterLabel);

            // Already setting up victory dialogue.
#warning You may not set the relative position after setting the anchor or every child box will not show up correctly
            centerBox = new Layout.Box("centerBox");
            centerBox.percentageSize      = new SizeF(25, 15);
            centerBox.anchor              = Layout.Anchor.Center;
            centerBox.borderLine.Width    = 3;
            centerBox.borderLine.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
            centerBox.fill = Brushes.LightBlue;

            caption             = new Layout.Textbox("caption");
            caption.parent      = centerBox;
            caption.text        = "Please enter your name:";
            caption.percentageY = 20;
            caption.anchor      = Layout.Anchor.CenterX;

            inputBox                     = new Layout.Inputbox("inputBox");
            inputBox.parent              = centerBox;
            inputBox.percentageY         = 60;
            inputBox.anchor              = Layout.Anchor.CenterX;
            inputBox.text                = "";
            inputBox.maxLength           = 15;
            inputBox.maxSize             = true;
            inputBox.textAnchor          = Layout.Anchor.Center;
            inputBox.OnDelimiterEntered += NameEntered;

            layout.AddBox(centerBox);
            layout.AddBox(caption);
            layout.AddBox(inputBox);
        }