コード例 #1
0
        MazeFrameViewModel UpdateBoxes(double wallLength)
        {
            // 赤箱
            if (MazeContentData.RedboxPosition.HasValue)
            {
                var redbox = DrawUtility.NewRedbox(MazeContentData.RedboxPosition.Value, Margin, wallLength);
                AddViewItemCommand?.Execute(redbox);
            }

            // 黄箱
            if (MazeContentData.YellowboxPosition.HasValue)
            {
                var yellowbox = DrawUtility.NewYellowbox(MazeContentData.YellowboxPosition.Value, Margin, wallLength);
                AddViewItemCommand?.Execute(yellowbox);
            }

            // 緑箱
            foreach (var greenboxPosition in MazeContentData.GreenboxPositions)
            {
                var greenbox = DrawUtility.NewGreenbox(greenboxPosition, Margin, wallLength);
                AddViewItemCommand?.Execute(greenbox);
            }

            return(this);
        }
コード例 #2
0
ファイル: DrawSetting.cs プロジェクト: Hengle/ClientFrameWork
    // Use this for initialization
    void Start()
    {
        penX.onValueChange.AddListener(ChangePenX);
        penY.onValueChange.AddListener(ChangePenY);
        brushX.onValueChange.AddListener(ChangeBrushX);
        brushY.onValueChange.AddListener(ChangeBrushY);
        bSize.onValueChange.AddListener(ChangeBSize);

        penX.text   = PlayerPrefs.GetInt("penOffsetX", 0).ToString();
        penY.text   = PlayerPrefs.GetInt("penOffsetY", 0).ToString();
        brushX.text = PlayerPrefs.GetInt("brushOffsetX", 0).ToString();
        brushY.text = PlayerPrefs.GetInt("brushOffsetY", 0).ToString();
        bSize.text  = PlayerPrefs.GetInt("bSize", 10).ToString();

        var detector = DrawUtility.CreateDetector(prefab);

        detector.OnStartPaint    += new PaintingDetector2D.DelegatePaint(OnStartPaint);
        detector.OnPaintMovement += new PaintingDetector2D.DelegatePaint(OnPaintMovement);
        detector.OnPaintEnd      += new PaintingDetector2D.DelegatePaint(OnPaintEnd);


        drawRect          = DrawUtility.CreateRectTransform(prefab, new Vector2(Screen.width, Screen.height));
        drawImage         = drawRect.GetComponent <RawImage>();
        paintTexture      = DrawUtility.CreateCanvas(Screen.width, Screen.height);
        drawImage.texture = paintTexture;

        btn.onClick.AddListener(Click);
    }
コード例 #3
0
ファイル: Base.cs プロジェクト: lazydog8242/GiddyUpCore
        public override void DefsLoaded()
        {
            base.DefsLoaded();

            List <ThingDef> allAnimals = DefUtility.getAnimals();

            allAnimals = allAnimals.OrderBy(o => o.defName).ToList();

            tabsHandler    = Settings.GetHandle <String>("tabs", "GUC_Tabs_Title".Translate(), "", "none");
            bodySizeFilter = Settings.GetHandle <float>("bodySizeFilter", "GUC_BodySizeFilter_Title".Translate(), "GUC_BodySizeFilter_Description".Translate(), 0.8f);
            animalSelecter = Settings.GetHandle <DictAnimalRecordHandler>("Animalselecter", "GUC_Animalselection_Title".Translate(), "GUC_Animalselection_Description".Translate(), getDefaultForAnimalSelecter(allAnimals));
            drawSelecter   = Settings.GetHandle <DictAnimalRecordHandler>("drawSelecter", "GUC_Drawselection_Title".Translate(), "GUC_Drawselection_Description".Translate(), getDefaultForDrawSelecter(allAnimals));


            tabsHandler.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Tabs(rect, tabsHandler, tabNames)); };

            bodySizeFilter.CustomDrawer        = rect => { return(DrawUtility.CustomDrawer_Filter(rect, bodySizeFilter, false, 0, 5, highlight1)); };
            animalSelecter.CustomDrawer        = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, animalSelecter, allAnimals, bodySizeFilter, "GUC_SizeOk".Translate(), "GUC_SizeNotOk".Translate())); };
            bodySizeFilter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); };
            animalSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); };


            drawSelecter.CustomDrawer        = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, drawSelecter, allAnimals, null, "GUC_DrawFront".Translate(), "GUC_DrawBack".Translate())); };
            drawSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[1]); };

            if (animalSelecter.Value == null)
            {
                animalSelecter.Value = getDefaultForAnimalSelecter(allAnimals);
            }
            if (drawSelecter.Value == null)
            {
                drawSelecter.Value = getDefaultForDrawSelecter(allAnimals);
            }
        }
コード例 #4
0
 public virtual void Draw(SpriteBatch spriteBatch)
 {
     if (IsVisible && TDGameLibrary.GameEnvironment.IsDebugModeActive)
     {
         DrawUtility.DrawRectangle(DisplayRectangle, Color.PaleTurquoise);
     }
 }
コード例 #5
0
    void BeginOutline()
    {
        paintTexture      = DrawUtility.CreateCanvas(outline.width, outline.height);
        drawImage.texture = paintTexture;
        //drawImage.SetNativeSize();

        //detector = drawImage.GetComponent<PaintingDetector2D>();
        if (detector == null)
        {
            Debug.LogError("no paint detector!");
        }
        detector.OnStartPaint    += new PaintingDetector2D.DelegatePaint(OnStartPaint);
        detector.OnPaintMovement += new PaintingDetector2D.DelegatePaint(OnPaintMovement);
        detector.OnPaintEnd      += new PaintingDetector2D.DelegatePaint(OnPaintEnd);

        maskImage.texture = outlineMask;
        //outlineMaskImage.SetNativeSize();

        var pixels = outline.GetPixels();

        foreach (var pix in pixels)
        {
            if (pix.a > 0)
            {
                totalCount++;
            }
        }

        palette.gameObject.SetActive(false);
        state = GameState.PaintOutline;
    }
コード例 #6
0
 protected void DrawScriptFeatures()
 {
     GUILayout.Space(5);
     DrawUtility.DrawVertical(() =>
     {
         GUILayout.Space(5);
         DrawUtility.DrawHorizontal(() =>
         {
             GUILayout.Space(10);
             EditorGUILayout.LabelField("Script features", EditorStyles.boldLabel);
         });
         GUILayout.Space(5);
         DrawUtility.DrawHorizontal(() =>
         {
             GUILayout.Space(10);
             var script = MonoScript.FromScriptableObject(this);
             DrawUtility.DrawButton(IconName.EYE, "Focus Script", () => EditorGUIUtility.PingObject(script),
                                    GUILayout.Width(110), GUILayout.Height(20));
             DrawUtility.DrawButton(IconName.CS_SCRIPT_ICON, "Open Script", () => AssetDatabase.OpenAsset(script),
                                    GUILayout.Width(110), GUILayout.Height(20));
             DrawUtility.DrawButton(IconName.REFRESH, "Refresh Window", InitWindow, GUILayout.Width(130), GUILayout.Height(20));
             GUILayout.FlexibleSpace();
             GUILayout.Space(10);
         });
         GUILayout.Space(10);
     }, GUI.skin.textField);
 }
コード例 #7
0
        public StationAreaItem AddPointArea(MSTSCoord coord, double snapDist, MSTSBase tileBase)
        {
            PointF found = new PointF(0, 0);
            double dist = -1, closestDist = double.PositiveInfinity;
            int    i;
            int    closestI = -1;
            PointF closest;

            StationAreaItem newPoint = new StationAreaItem(TypeEditor.ROUTECONFIG, this);

            if (areaCompleted)
            {
                StationAreaItem p1;
                StationAreaItem p2;
                for (i = 0; i < stationArea.Count - 1; i++)
                {
                    p1   = stationArea[i];
                    p2   = stationArea[i + 1];
                    dist = DrawUtility.FindDistanceToSegment(coord.ConvertToPointF(),
                                                             new AESegment(p1.Coord.ConvertToPointF(), p2.Coord.ConvertToPointF()), out found);
                    if (dist >= 0 && dist < snapDist && dist < closestDist)
                    {
                        closestDist = dist;
                        closestI    = i + 1;
                        closest     = found;
                    }
                    dist = -1;
                }
                p1   = stationArea[stationArea.Count - 1];
                p2   = stationArea[0];
                dist = DrawUtility.FindDistanceToSegment(coord.ConvertToPointF(),
                                                         new AESegment(p1.Coord.ConvertToPointF(), p2.Coord.ConvertToPointF()), out closest);

                if (dist >= 0 && dist < snapDist && dist < closestDist)
                {
                    closestDist = dist;
                    closestI    = 0;
                    closest     = found;
                }
                if (closestDist < double.PositiveInfinity)
                {
                    coord = tileBase.getMstsCoord(closest);
                    newPoint.configCoord(coord);
                    newPoint.toggleSelected();
                    stationArea.Insert(closestI, newPoint);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                //  Until area complete, we only add new point at the end
                newPoint.configCoord(coord);
                newPoint.toggleSelected();
                stationArea.Add(newPoint);
            }
            return(newPoint);
        }
コード例 #8
0
        /// <summary>
        /// 获取圆形起点按钮和出发箭头的接触点,即为箭头的实际尾部坐标
        /// </summary>
        /// <param name="degree"></param>
        /// <returns></returns>
        public override Point GetNextArrowTail(double degree)
        {
            Point arrowPoint = DrawUtility.GetCyclePoint(100, 0, degree);
            int   x          = (this.Left + this.Right) / 2 + arrowPoint.X * Radius / 100;
            int   y          = (this.Top + this.Bottom) / 2 + arrowPoint.Y * Radius / 100;

            return(new Point(x, y));
        }
コード例 #9
0
ファイル: Base.cs プロジェクト: SaintBenedict/ModPack-RW-1.1
        public override void DefsLoaded()
        {
            float maxWeightMelee;
            float maxWeightRanged;

            allWeapons = WeaponUtility.getAllWeapons();
            WeaponUtility.getHeaviestWeapons(allWeapons, out maxWeightMelee, out maxWeightRanged);
            maxWeightMelee  += 1;
            maxWeightRanged += 1;
            float maxWeightTotal = Math.Max(maxWeightMelee, maxWeightRanged);

            dialogCEShown = Settings.GetHandle <bool>("dialogCEShown", "", "", false);
            dialogCEShown.VisibilityPredicate = delegate { return(false); };

            bool combatExtendedLoaded = AssemblyExists("CombatExtended");

            if (combatExtendedLoaded && !dialogCEShown)
            {
                Find.WindowStack.Add(new Dialog_CE("RG_Dialog_CE_Title".Translate(), "RG_Dialog_CE_Description".Translate()));
            }
            if (!combatExtendedLoaded)
            {
                dialogCEShown.Value   = false;
                dialogCEShown.Unsaved = false;
                //Base.
            }

            enableForAI         = Settings.GetHandle <bool>("enableRGForAI", "RG_EnableRGForAI_Title".Translate(), "RG_EnableRGForAI_Description".Translate(), true);
            enableForFleeChance = Settings.GetHandle <int>("enableRGForFleeChance", "RG_EnableRGForFleeChance_Title".Translate(), "RG_EnableRGForFleeChance_Description".Translate(), 100, Validators.IntRangeValidator(minPercentage, maxPercentage));
            enableForFleeChance.VisibilityPredicate = delegate { return(enableForAI.Value); };

            accuracyPenalty = Settings.GetHandle <int>("accuracyPenalty", "RG_AccuracyPenalty_Title".Translate(), "RG_AccuracyPenalty_Description".Translate(), 10, Validators.IntRangeValidator(minPercentage, maxPercentage));

            movementPenaltyHeavy = Settings.GetHandle <int>("movementPenaltyHeavy", "RG_MovementPenaltyHeavy_Title".Translate(), "RG_MovementPenaltyHeavy_Description".Translate(), 40, Validators.IntRangeValidator(minPercentage, maxPercentage));
            movementPenaltyLight = Settings.GetHandle <int>("movementPenaltyLight", "RG_MovementPenaltyLight_Title".Translate(), "RG_MovementPenaltyLight_Description".Translate(), 10, Validators.IntRangeValidator(minPercentage, maxPercentage));

            tabsHandler = Settings.GetHandle <String>("tabs", "RG_Tabs_Title".Translate(), "", "none");
            tabsHandler.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Tabs(rect, tabsHandler, tabNames)); };

            weightLimitFilter = Settings.GetHandle <float>("weightLimitFilter", "RG_WeightLimitFilter_Title".Translate(), "RG_WeightLimitFilter_Description".Translate(), 3.4f);
            weightLimitFilter.CustomDrawer        = rect => { return(DrawUtility.CustomDrawer_Filter(rect, weightLimitFilter, false, 0, maxWeightTotal, highlight1)); };
            weightLimitFilter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); };

            weaponSelecter = Settings.GetHandle <DictWeaponRecordHandler>("weaponSelecter_new", "RG_WeaponSelection_Title".Translate(), "RG_WeaponSelection_Description".Translate(), null);
            weaponSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); };

            weaponForbidder = Settings.GetHandle <DictWeaponRecordHandler>("weaponForbidder_new", "RG_WeaponForbidder_Title".Translate(), "RG_WeaponForbidder_Description".Translate(), null);
            weaponForbidder.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[1]); };

            weaponSelecter.CustomDrawer  = rect => { return(DrawUtility.CustomDrawer_MatchingWeapons_active(rect, weaponSelecter, allWeapons, weightLimitFilter, "RG_ConsideredLight".Translate(), "RG_ConsideredHeavy".Translate())); };
            weaponForbidder.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_MatchingWeapons_active(rect, weaponForbidder, allWeapons, null, "RG_Allow".Translate(), "RG_Forbid".Translate())); };

            DrawUtility.filterWeapons(ref weaponSelecter, allWeapons, weightLimitFilter);
            DrawUtility.filterWeapons(ref weaponForbidder, allWeapons, null);
        }
コード例 #10
0
        public override void DefsLoaded()
        {
            base.DefsLoaded();
            List <ThingDef> mechDefs = GetMechDefs();

            mountChance    = Settings.GetHandle <int>("mountChance", "GU_BME_MountChance_Title".Translate(), "GU_BME_MountChance_Description".Translate(), 40, Validators.IntRangeValidator(0, 100));
            bodySizeFilter = Settings.GetHandle <float>("bodySizeFilter", "GU_BME_BodySizeFilter_Title".Translate(), "GU_BME_BodySizeFilter_Description".Translate(), 1.01f);
            mechSelector   = Settings.GetHandle <DictAnimalRecordHandler>("mechSelector", "GU_BME_Mechselection_Title".Translate(), "GU_BME_Mechselection_Description".Translate(), null);
            bodySizeFilter.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Filter(rect, bodySizeFilter, false, 0, 5, highlight1)); };
            mechSelector.CustomDrawer   = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, mechSelector, GetMechDefs(), bodySizeFilter, "GUC_SizeOk".Translate(), "GUC_SizeNotOk".Translate())); };
            DrawUtility.filterAnimals(ref mechSelector, mechDefs, bodySizeFilter);
        }
コード例 #11
0
ファイル: Base.cs プロジェクト: emipa606/UseYourGun
 // Token: 0x0600000F RID: 15 RVA: 0x00002470 File Offset: 0x00000670
 public override void DefsLoaded()
 {
     this.allWeapons = WeaponUtility.getAllWeapons();
     if (Prefs.DevMode)
     {
         Log.Message($"Found {allWeapons.Count} weapons in the database.");
     }
     Base.tabsHandler = base.Settings.GetHandle <string>("tabs", Translator.Translate("UYG_Tabs_Title"), "", "none", null, null);
     Base.tabsHandler.CustomDrawer            = ((Rect rect) => DrawUtility.CustomDrawer_Tabs(rect, Base.tabsHandler, this.tabNames));
     Base.weaponForbidder                     = base.Settings.GetHandle <DictWeaponRecordHandler>("weaponForbidder_new", null, Translator.Translate("UYG_WeaponForbidder_Description"), null, null, null);
     Base.weaponForbidder.VisibilityPredicate = (() => Base.tabsHandler.Value == this.tabNames[0]);
     Base.weaponForbidder.CustomDrawer        = ((Rect rect) => DrawUtility.CustomDrawer_MatchingWeapons_active(rect, Base.weaponForbidder, this.allWeapons, null, Translator.Translate("UYG_Allow"), Translator.Translate("UYG_Forbid")));
     DrawUtility.filterWeapons(ref Base.weaponForbidder, this.allWeapons, null);
 }
コード例 #12
0
        MazeFrameViewModel UpdateWalls(double wallLength)
        {
            foreach (var position in MazeFrameData.WallPositions)
            {
                var p1 = position.Item1;
                var p2 = position.Item2;

                var wall = DrawUtility.NewWall(p1.x1 * wallLength + Margin, p1.y1 * wallLength + Margin,
                                               p2.x2 * wallLength + Margin, p2.y2 * wallLength + Margin,
                                               5d);
                AddViewItemCommand?.Execute(wall);
            }

            return(this);
        }
コード例 #13
0
 private void OnGUI()
 {
     titleContent = new GUIContent(DrawUtility.DrawIcon("SaveActive"))
     {
         text = " Edit Saved Data"
     };
     minSize = new Vector2(400, 65);
     DrawScriptFeatures();
     GUILayout.Space(5);
     DrawAllData(() =>
     {
         DrawPlayerData();
         DrawSettingsData();
     });
 }
コード例 #14
0
        public void checkForNewConnector(ORRouteConfig orRouteConfig, List <TrackSegment> segments, MSTSBase tileBase)
        {
            PointF pointIntersect;
            int    realPosit = 0;
            int    ii        = 0;

            //  First, we remove all un configured connectors
            //foreach (StationAreaItem SAWidget in stationArea)
            for (int cnt = 0; cnt < stationArea.Count; cnt++)
            {
                var SAWidget = stationArea[cnt];
                if (SAWidget.IsInterface() && !SAWidget.getStationConnector().isConfigured())
                {
                    removeConnector(orRouteConfig, SAWidget);
                    cnt--;
                }
            }
            //  Next, we search for new connectors and add them
            List <AESegment> polySegment = getPolySegment();

            for (int cntPointEdge = 0; cntPointEdge < polySegment.Count; cntPointEdge++)
            {
                List <System.Drawing.PointF> pointsIntersect = new List <System.Drawing.PointF>();
                foreach (var segment in segments)
                {
                    if ((segment.NodeIdx == 35 || segment.NodeIdx == 86) && cntPointEdge > 2 &&
                        (segment.SectionIdxA == 191 || segment.SectionIdxA == 40000))
                    {
                        ii = 1;
                    }
                    pointIntersect = DrawUtility.FindIntersection(polySegment[cntPointEdge], new AESegment(segment));
                    if (!pointIntersect.IsEmpty)
                    {
                        StationAreaItem newPoint = new StationAreaItem(TypeEditor.ROUTECONFIG, this);
                        MSTSCoord       coord    = tileBase.getMstsCoord(pointIntersect);
                        newPoint.configCoord(coord);
                        //newPoint.toggleSelected();
                        realPosit++;    // +1 car on doit placer après le cntEdge courant
                        List <AESegment> newPolySegment = getPolySegment();
                        insertConnector(newPolySegment, newPoint);
                        newPoint.DefineAsInterface(segment);
                    }
                }
                realPosit++;    //  On incrémente pour suivre le cntPointEdge
            }
        }
コード例 #15
0
    void InitData()
    {
        var     rad  = Screen.height * 0.75f;
        Vector2 size = new Vector2((int)rad, (int)rad);

        detector = DrawUtility.CreateDetector(prefab);

        drawRect  = DrawUtility.CreateRectTransform(prefab, size);
        drawImage = drawRect.GetComponent <RawImage>();


        maskRect  = DrawUtility.CreateRectTransform(prefab, size);
        maskImage = maskRect.GetComponent <RawImage>();


        prefab.gameObject.SetActive(false);
    }
コード例 #16
0
 private static IconLabelWindow BaseInit(string iconName, string label, int fontSize, Color contentColor, Vector2 size,
                                         Vector2?position = null, Action <int> onCloseEvent = null)
 {
     m_instance                = GetWindow <IconLabelWindow>();
     m_instance.m_label        = label;
     m_instance.m_fontSize     = fontSize;
     m_instance.m_contentColor = contentColor;
     m_instance.titleContent   = DrawUtility.DrawIcon(iconName);
     m_instance.maxSize        = m_instance.minSize = size;
     m_instance.maximized      = false;
     if (position != null)
     {
         m_instance.position = new Rect((Vector2)position, size);
     }
     m_instance.m_onCloseEvent = onCloseEvent;
     m_instance.Show();
     return(m_instance);
 }
コード例 #17
0
    protected void DrawData(DataType dataType, ref bool unfold, Action drawAction)
    {
        var label       = Regex.Replace(dataType.ToString(), "([a-z])([A-Z])", "$1 $2");
        var lblSize     = label.Length;
        var localUnfold = unfold;

        DrawUtility.DrawHorizontal(() =>
        {
            GUILayout.Space(5);
            DrawUtility.DrawVertical(() =>
            {
                GUILayout.Space(5);
                DrawUtility.DrawFoldableBox(label, ref localUnfold,
                                            () =>
                {
                    DrawUtility.DrawHorizontalLine();
                    DrawUtility.DrawHorizontal(() =>
                    {
                        GUILayout.Space(5);
                        DrawUtility.DrawButton(IconName.SAVE, $"Save {label}",
                                               () => DrawUtility.YesNoDialog($"Save {label}", $"Are you sure to overwrite {label}?",
                                                                             () => SavedDataServices.Save(dataType)),
                                               GUILayout.Height(35), GUILayout.Width(35 + (9 + lblSize) * 5));

                        DrawUtility.DrawButton(IconName.REFRESH, $"Reload {label}",
                                               () => SavedDataServices.Load(dataType), GUILayout.Height(35),
                                               GUILayout.Width(35 + (11 + lblSize) * 5));

                        DrawUtility.DrawButton(IconName.TRASH, $"Reset {label}",
                                               () => DrawUtility.YesNoDialog($"Reset {label}", $"Are you sure to reset {label}?",
                                                                             () => SavedDataServices.ResetData(dataType)),
                                               GUILayout.Height(35), GUILayout.Width(35 + (10 + lblSize) * 5));
                    });
                    GUILayout.Space(5);
                    DrawUtility.DrawHorizontalLine();

                    drawAction();

                    GUILayout.Space(5);
                }, Indent.Nothing);
            });
        });
        unfold = localUnfold;
    }
コード例 #18
0
    private void Start()
    {
        DrawUtility.DrawLine(new Coo2D(0, -maxHeight), new Coo2D(0, maxHeight), 1f, Color.green);
        DrawUtility.DrawLine(new Coo2D(-maxWidth, 0), new Coo2D(maxWidth, 0), 1f, Color.red);

        int xInterval = (int)(maxWidth / (float)size);

        for (int x = -xInterval * size; x <= xInterval * size; x += size)
        {
            DrawUtility.DrawLine(new Coo2D(x, -maxHeight), new Coo2D(x, maxHeight), 0.5f, Color.white);
        }

        int yInterval = (int)(maxHeight / (float)size);

        for (int y = -yInterval * size; y <= yInterval * size; y += size)
        {
            DrawUtility.DrawLine(new Coo2D(-maxWidth, y), new Coo2D(maxWidth, y), 0.5f, Color.white);
        }
    }
コード例 #19
0
    private void OnGUI()
    {
        GUILayout.FlexibleSpace();
        DrawUtility.DrawHorizontal(() =>
        {
            GUILayout.FlexibleSpace();
            var style = new GUIStyle(GUI.skin.label)
            {
                fontSize  = m_fontSize,
                fontStyle = FontStyle.Bold,
            };
            style.normal.textColor = style.active.textColor = style.focused.textColor = style.hover.textColor = m_contentColor;

            GUILayout.Label(m_label, style);
            GUILayout.FlexibleSpace();
        });
        GUILayout.FlexibleSpace();
        m_extraDrawAction?.Invoke();
    }
コード例 #20
0
        MazeFrameViewModel UpdateFrame(double wallLength)
        {
            // 縦線
            for (var i = 0; i <= MazeFrameData.SizeX; ++i)
            {
                var x     = Margin + i * wallLength;
                var yWall = DrawUtility.NewWall(x, 0d + Margin, x, Size - Margin, 1d);
                AddViewItemCommand?.Execute(yWall);
            }

            // 横線
            for (var j = 0; j <= MazeFrameData.SizeY; ++j)
            {
                var y     = Margin + j * wallLength;
                var xWall = DrawUtility.NewWall(0d + Margin, y, Size - Margin, y, 1d);
                AddViewItemCommand?.Execute(xWall);
            }

            return(this);
        }
コード例 #21
0
        /// <summary>
        /// Handles the ValueChanged event of the ultraOptionSet1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ultraOptionSet1_ValueChanged(object sender, EventArgs e)
        {
            Image newImage   = null;
            Size  editorSize = this.imageEditorSize;

            if (this.ultraOptionSet1.CheckedIndex == 0) // scale image
            {
                newImage = DrawUtility.CreateScaledImage(this.originalImage, editorSize, new Rectangle(Point.Empty, this.originalImage.Size));
            }
            else // clip image
            {
                Image clippedImage = new Bitmap(editorSize.Width, editorSize.Height);
                using (Graphics grfx = Graphics.FromImage(clippedImage))
                {
                    grfx.DrawImage(this.originalImage, new Rectangle(0, 0, editorSize.Width, editorSize.Height),
                                   new Rectangle(0, 0, editorSize.Width, editorSize.Height), GraphicsUnit.Pixel);
                    newImage = clippedImage;
                }
            }
            this.ultraPictureBox1.Image = newImage;
        }
コード例 #22
0
        public void setIcoAngle(PointF posit, List <PointF> polyPoints)
        {
            double tempo;
            PointF end1 = new System.Drawing.PointF((float)segment.A.X, (float)segment.A.Y);
            PointF end2 = new System.Drawing.PointF((float)segment.B.X, (float)segment.B.Y);

            if (DrawUtility.PointInPolygon(end1, polyPoints))
            {
                tempo = Math.Atan2(end1.X - posit.X, end1.Y - posit.Y);
                angle = (float)((tempo * 180.0d) / Math.PI) - 90f;
            }
            else if (DrawUtility.PointInPolygon(end2, polyPoints))
            {
                tempo = Math.Atan2(end2.X - posit.X, end2.Y - posit.Y);
                angle = (float)((tempo * 180.0d) / Math.PI) - 90f;
            }
            else
            {
                angle = 0.0f;
            }
        }
コード例 #23
0
 public static void StartServices()
 {
     if (GamePlayComponentManager != null)
     {
         throw new InvalidOperationException("Service already started.");
     }
     else
     {
         // Top level services
         UiManager = new UiComponentManager(SpriteBatch)
         {
             IsPauseIgnored = true
         };
         GamePlayComponentManager = new TdglComponentManager(GameEnvironment.Game, UiManager);
         WorldManager             = GamePlayComponentManager.AddComponent(new WorldManager(new World(Vector2.Zero)));
         GhostBodyManager         = GamePlayComponentManager.AddComponent(new GhostBodyManager());
         PooledBodyManager        = GamePlayComponentManager.AddComponent(new PooledBodyManager(WorldManager, GhostBodyManager));
         MobManager  = GamePlayComponentManager.AddComponent(new MobManager(WorldManager));
         DrawUtility = GamePlayComponentManager.AddComponent(new DrawUtility(SpriteBatch));
     }
 }
コード例 #24
0
        public TrackSegment(TrackNodeAE nodeA, TrackNodeAE nodeB, TSectionDatFile tdf, int i)
        {
            tcIndex = new List <int>();

            int direction = DrawUtility.getDirection(nodeA, nodeB);

            A           = nodeA.getMSTSCoord(direction);
            B           = nodeB.getMSTSCoord(direction);
            NodeIdx     = nodeA.Index;
            SectionIdxB = (uint)i;
            if (nodeA.TrJunctionNode != null)
            {
                direction   = DrawUtility.getDirection(nodeB, nodeA);
                SectionIdxA = nodeB.getSectionIndex(direction);
                if (nodeB.TCCrossReference != null)
                {
                    foreach (var tcc in nodeB.TCCrossReference)
                    {
                        tcIndex.Add(tcc.CrossRefIndex);
                    }
                }
            }
            else
            {
                SectionIdxA = nodeA.getSectionIndex(direction);
                if (nodeA.TCCrossReference != null)
                {
                    foreach (var tcc in nodeA.TCCrossReference)
                    {
                        tcIndex.Add(tcc.CrossRefIndex);
                    }
                }
            }
            isCurved = false;
            WorldUid = nodeA.getWorldFileUiD();
            CheckCurve(tdf, direction);
            linkToOther = true;
        }
コード例 #25
0
ファイル: ProcessButton.cs プロジェクト: windygu/.net-wms
        /// <summary>
        /// </summary>
        private void miJump_Click(object sender, EventArgs e)
        {
            //选择目标点
            ProcessButton     pbEnd = null;
            SelectProcessForm spf   = new SelectProcessForm(this.Parent);

            if (spf.ShowDialog() == DialogResult.OK)
            {
                pbEnd = spf.SelectedButton;
                int length = 0;
                if (pbEnd.Left > this.Left)
                {
                    length = Math.Abs(pbEnd.Left - this.Left - DrawUtility.a);
                }
                else
                {
                    length = Math.Abs(this.Left - pbEnd.Left - DrawUtility.a);
                }

                bool            isBack = pbEnd.Left < this.Left;
                JumpArrowButton jab    = new JumpArrowButton(isBack, length);
                DrawUtility.DrawJumpArrow(jab, null, length, isBack);
                if (pbEnd.Left > this.Left)
                {
                    jab.Left = this.Left + this.Width / 2 - DrawUtility.a;
                    jab.Top  = this.Top - 12 * DrawUtility.a;
                }
                else
                {
                    jab.Left = pbEnd.Left + pbEnd.Width / 2 - DrawUtility.a;
                    jab.Top  = this.Top - 17 * DrawUtility.a;
                }
                this.Parent.Controls.Add(jab);
                OutFlows.Add(jab);
                jab.FromProcesses.Add(this);
                jab.ToProcesses.Add(pbEnd);
            }
        }
コード例 #26
0
        MazeFrameViewModel UpdateGoal(double wallLength)
        {
            if (!MazeFrameData.GoalPosition.HasValue)
            {
                return(this);
            }

            // ゴール上に箱があれば箱優先
            // 赤箱
            if (MazeContentData.RedboxPosition.HasValue &&
                MazeContentData.RedboxPosition.Value.x == MazeFrameData.GoalPosition.Value.x &&
                MazeContentData.RedboxPosition.Value.y == MazeFrameData.GoalPosition.Value.y)
            {
                return(this);
            }
            // 黄箱
            if (MazeContentData.YellowboxPosition.HasValue &&
                MazeContentData.YellowboxPosition.Value.x == MazeFrameData.GoalPosition.Value.x &&
                MazeContentData.YellowboxPosition.Value.y == MazeFrameData.GoalPosition.Value.y)
            {
                return(this);
            }
            // 緑箱
            foreach (var greenbox in MazeContentData.GreenboxPositions)
            {
                if (greenbox.x == MazeFrameData.GoalPosition.Value.x &&
                    greenbox.y == MazeFrameData.GoalPosition.Value.y)
                {
                    return(this);
                }
            }

            var goal = DrawUtility.NewGoal(MazeFrameData.GoalPosition.Value, Margin, wallLength);

            AddViewItemCommand?.Execute(goal);

            return(this);
        }
コード例 #27
0
        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (IsVisible && TDGameLibrary.GameEnvironment.IsDebugModeActive)
            {
                DrawUtility.DrawRectangle(DisplayRectangle, Color.Turquoise);
            }

            if (BackgroundTexture != null && IsVisible)
            {
                Rectangle destination = (BackgroundTextureDestinationRectangle.Width == 0 ? DisplayRectangle : BackgroundTextureDestinationRectangle);
                Vector4   v           = BackgroundColor.ToVector4();
                spriteBatch.Draw(BackgroundTexture, destination, BackgroundColor.ToOpacity(v.W * Opacity));
            }

            ControlManager.Draw(spriteBatch);

            // Control Manager calls Draw on controls already

            foreach (UiContainer childContainer in ChildContainers)
            {
                childContainer.Draw(gameTime, spriteBatch);
            }
        }
コード例 #28
0
    void FinishOutline()
    {
        state = GameState.FinishOutline;

        detector.OnStartPaint    -= new PaintingDetector2D.DelegatePaint(OnStartPaint);
        detector.OnPaintMovement -= new PaintingDetector2D.DelegatePaint(OnPaintMovement);
        detector.OnPaintEnd      -= new PaintingDetector2D.DelegatePaint(OnPaintEnd);

        indicator.gameObject.SetActive(false);

        maskImage.texture = outline;
        maskRect.SetSiblingIndex(drawRect.GetSiblingIndex());
        outline           = body;
        paintTexture      = DrawUtility.CreateCanvas(outline.width, outline.height);
        drawImage.texture = paintTexture;

        var bRect = DrawUtility.CreateRectTransform(maskRect, maskRect.sizeDelta);
        var image = bRect.GetComponent <RawImage>();

        image.texture = blink;

        float     time = 1.5f;
        Hashtable hash = new Hashtable();

        hash.Add("a", 0);
        hash.Add("time", time);
        iTween.ColorFrom(bRect.gameObject, hash);
        Hashtable hash2 = new Hashtable();

        hash2.Add("a", 0);
        hash2.Add("time", time);
        hash2.Add("delay", time);
        hash2.Add("oncomplete", "FinishBlink");
        hash2.Add("oncompletetarget", gameObject);
        hash2.Add("oncompleteparams", image.gameObject);
        iTween.ColorTo(bRect.gameObject, hash2);
    }
コード例 #29
0
ファイル: ButtonWithParams.cs プロジェクト: labais/e_homework
        protected override void DrawInternal(object[] targets)
        {
            (Rect foldoutRect, Rect buttonRect) = DrawUtility.GetFoldoutAndButtonRects(DisplayName);

            _expanded = DrawUtility.DrawInFoldout(foldoutRect, _expanded, DisplayName, () =>
            {
                foreach (Parameter param in _parameters)
                {
                    param.Draw();
                }
            });

            if (!GUI.Button(buttonRect, "Invoke"))
            {
                return;
            }

            var paramValues = _parameters.Select(param => param.Value).ToArray();

            foreach (object obj in targets)
            {
                Method.Invoke(obj, paramValues);
            }
        }
コード例 #30
0
        public static void Postfix()
        {
            if (Event.current.type == EventType.Layout)
            {
                return;
            }

            if (Event.current.type == EventType.Repaint)
            {
                _settings.UISettingsChanged    = false;
                BCBManager.ModColonistBarDirty = false;
            }

            try
            {
                Rect buttonRect = GetRect();

                bool showButton = !_settings.AutoHide;
                if (!showButton)
                {
                    bool timetoShowButton = false;

                    if (_firstDraw)
                    {
                        _firstDraw    = false;
                        _lastTimeShow = DateTime.UtcNow;
                    }
                    else if (DateTime.UtcNow - _lastTimeShow < _settings.AutoHideButtonTime)
                    {
                        timetoShowButton = true;
                    }
                    else if (MouseIsOver(buttonRect))
                    {
                        timetoShowButton = true;
                        _lastTimeShow    = DateTime.UtcNow;
                    }

                    showButton |= timetoShowButton;
                }

                if (showButton)
                {
                    if (DrawUtility.ButtonInvertImage(buttonRect, BCBTexture.Expand, _color))
                    {
                        if (Event.current.button == 0)
                        {
                            BCBComponent.Expanded ^= true;
                            BCBManager.LastBarRect = Rect.zero;
                            Find.ColonistBar.MarkColonistsDirty();

                            return;
                        }
                    }
                }

                if (Event.current.type == EventType.KeyUp &&
                    Event.current.keyCode == _settings.HotKey &&
                    Event.current.control == _settings.CtrlKey)
                {
                    BCBComponent.Expanded ^= true;
                    BCBManager.LastBarRect = Rect.zero;
                    Find.ColonistBar.MarkColonistsDirty();

                    return;
                }

                if (Event.current.type != EventType.Repaint)
                {
                    return;
                }

                if (BCBManager.UpdateColonistBar())
                {
                    Find.ColonistBar.MarkColonistsDirty();
                }
            }
            catch (Exception e)
            {
                Log.Warning(e.ToString());
                BetterColonistBarMod.HasException    = true;
                BetterColonistBarMod.ExceptionReport = new ExceptionReport(e);
            }
        }