예제 #1
0
        protected override bool ValidateItem(CraftingBlueprint blueprint, DrawerBase drawer, bool refreshValues = false, bool isRoot = true)
        {
            var isValid = base.ValidateItem(blueprint, drawer, refreshValues, isRoot);

            if (isValid == false)
            {
                if (blueprint.requiredItems.Any(item => item.item == null) ||
                    blueprint.resultItems.Any(item => item.item == null) ||
                    blueprint.resultItems.Length == 0)
                {
                    itemsErrorLookup[blueprint].message += drawer.fieldName.text + " is empty" + '\n';
                    itemsErrorLookup[blueprint].drawers.Add(drawer);
                    return(false);
                }
            }

            return(isValid);
        }
예제 #2
0
        private void UpdateIssueFromReflectionDrawerRecursive(DrawerBase parent, UnityEngine.Object root)
        {
            var childrenDrawer = parent as IChildrenDrawer;

            if (childrenDrawer != null)
            {
                foreach (var child in childrenDrawer.children)
                {
                    UpdateIssueFromReflectionDrawerRecursive(child, root);
                }

                return;
            }

            if (parent != null && parent.required && parent.isEmpty)
            {
                CreateIssue(parent.fieldInfo, root);
            }
        }
예제 #3
0
        /// <summary>
        /// Draws a village on the map
        /// </summary>
        /// <param name="g">The graphics object</param>
        /// <param name="game">The game location of the village</param>
        /// <param name="mapVillage">Where and how big to draw the village</param>
        private void Paint(Graphics g, Point game, Rectangle mapVillage)
        {
            if (!(game.X >= 0 && game.X < 1000 && game.Y >= 0 && game.Y < 1000))
            {
                return;
            }

            Village    village;
            DrawerBase finalCache = null;

            if (World.Default.Villages.TryGetValue(game, out village))
            {
                Marker marker = _markers.GetMarker(Settings, village);
                if (marker != null)
                {
                    // Paint village icon/shape
                    BackgroundDrawerData mainData = World.Default.Views.GetBackgroundDrawerData(village, marker);
                    if (mainData != null)
                    {
                        finalCache = _drawerFactoryStrategy.CreateVillageDrawer(village.Bonus, mainData, marker);
                        if (finalCache != null)
                        {
                            finalCache.PaintVillage(g, mapVillage);

                            if (_drawerFactoryStrategy.SupportDecorators && village.Type != VillageType.None)
                            {
                                // Paint extra village decorators
                                foreach (DrawerBase decorator in World.Default.Views.GetDecoratorDrawers(_drawerFactoryStrategy, village, mainData))
                                {
                                    decorator.PaintVillage(g, mapVillage);
                                }
                            }
                        }
                    }
                }
            }

            if (finalCache == null)
            {
                PaintNonVillage(g, game, mapVillage);
            }
        }
예제 #4
0
        /// <summary>
        ///  このオブジェクトに格納されている全ての画像を重ねた画像を返します。
        /// </summary>
        /// <returns>重ねた後の<see cref="System.Drawing.Image"/>です。</returns>
        public override Image ToImage()
        {
            Image result = new Bitmap(_size.Width, _size.Height);

            using (Grap g = Grap.FromImage(result)) {
                foreach (var img in this.Items)
                {
                    DrawerBase drawer = img as DrawerBase;
                    if (drawer != null)
                    {
                        g.DrawImage(img.ToImage(), drawer.Location);
                    }
                    else
                    {
                        g.DrawImage(img.ToImage(), 0, 0);
                    }
                }
            }
            return(result);
        }
        public override void Draw(Rect rect, DialogueEditorWindow editor)
        {
            // Little bit of caching..
            if (_lastDialogue != editor.dialogue || _isDirty)
            {
                _lastDialogue = editor.dialogue;
                _drawer       = ReflectionDrawerUtility.BuildEditorHierarchy(typeof(Dialogue).GetField("variables"), _lastDialogue);

                _isDirty = false;
            }

            _drawer.Draw(ref rect);

//            rect.y += EditorGUIUtility.singleLineHeight;
//            if (GUI.Button(rect, "Add generic type"))
//            {
//                var l = new List<Variable>(_lastDialogue.variables.Cast<Variable>());
//                l.Add(new Variable<Vector2>());
//                _lastDialogue.variables = l.ToArray();
//
//                _isDirty = true;
//            }
        }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     drawer    = FindObjectOfType <DrawerBase>();
     drawables = FindObjectsOfType <DrawableBase>();
 }
 protected virtual void NotifyFieldChanged(DrawerBase drawer)
 {
 }
예제 #8
0
        /// <summary>
        /// Create drawer for village background (Shape/Icon)
        /// </summary>
        /// <param name="bonusType">Bonus villages have a different icon</param>
        /// <param name="data">The shape of the drawer</param>
        /// <param name="colors">The colors for the drawer</param>
        public DrawerBase CreateVillageDrawer(Village.BonusType bonusType, BackgroundDrawerData data, Marker colors)
        {
            DrawerBase drawer = CreateVillageDrawerCore(bonusType, data, colors);

            return(drawer);
        }
예제 #9
0
 public static bool IsFolded(DrawerBase drawer)
 {
     return(!IsUnFolded(drawer));
 }
예제 #10
0
 public static void Set(DrawerBase drawer, bool set)
 {
     _folds[drawer] = set;
 }
예제 #11
0
        public FoldoutBlock(DrawerBase drawer, Rect rect, GUIContent content)
        {
            _drawer = drawer;

            isUnFolded = EditorGUI.Foldout(rect, isUnFolded, content);
        }
예제 #12
0
 public virtual void Draw(DrawerBase d)
 {
     d.DrawRts(pingPongCanvasRts, d.drawPass);
 }
예제 #13
0
 public virtual void DrawGuid(DrawerBase d)
 {
     d.DrawRts(pingPongGuidRts, d.guidPass);
 }