예제 #1
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            var prop = Property as EdgeDrawProperty;

            if (prop == null)
            {
                return;
            }

            Drawers.Clear();

            var startVertexDrawerProp = new VertexDrawProperty();

            startVertexDrawerProp.Color    = prop.StartVertexColor;
            startVertexDrawerProp.Position = prop.StartVertex;
            Drawers.Add(new VertexDrawer(startVertexDrawerProp));

            var lineDrawerProp = new LineDrawerProperty();

            lineDrawerProp.Color       = prop.LineColor;
            lineDrawerProp.StartVertex = prop.StartVertex;
            lineDrawerProp.EndVertex   = prop.EndVertex;
            Drawers.Add(new LineDrawer(lineDrawerProp));

            var endVertexDrawerProp = new VertexDrawProperty();

            endVertexDrawerProp.Color    = prop.EndVertexColor;
            endVertexDrawerProp.Position = prop.EndVertex;
            Drawers.Add(new VertexDrawer(endVertexDrawerProp));
        }
예제 #2
0
        private void DrawBody(Rect position, IEditorDictionary dict)
        {
            foreach (KeyValuePair <object, object> entry in dict.GetEntries().ToList())
            {
                position = position.ColumnNext();

                float buttonWidth = ButtonDrawers.ButtonSize.x;
                float columnSize  = (position.width - buttonWidth) / 2;

                Rect[] row = position.SplitRow(columnSize, columnSize, buttonWidth);

                object newKey   = Drawers.Draw(row[0], dict.KeyType, entry.Key);
                object newValue = Drawers.Draw(row[1], dict.ValueType, entry.Value);

                if (newKey != entry.Key || newValue != entry.Value)
                {
                    dict.RemoveEntry(entry.Key);
                    dict.AddEntry(newKey, newValue);
                }

                if (ButtonDrawers.Minus(row[2]))
                {
                    dict.RemoveEntry(newKey);
                }
            }
        }
예제 #3
0
        public List <ObjectDTO> SceneReconstruction(int planId)
        {
            List <ObjectDTO> objects = new List <ObjectDTO>();

            List <BoxDTO> BoxesInPlan = Boxs.BoxesInPlan(planId);

            foreach (BoxDTO box in BoxesInPlan)
            {
                List <BoardDTO>  BoardsInBox  = Boards.BoardsInBox(box.Id);
                List <DrawerDTO> DrawersInBox = Drawers.DrawersInBox(box.Id);
                List <DoorDTO>   DoorsInBox   = Doors.DoorsInBox(box.Id);

                List <bool> PozicijeFioka = new List <bool>();
                List <bool> PozicijeVrata = new List <bool>();

                for (int i = 0; i < BoardsInBox.Count + 1; i++)
                {
                    PozicijeFioka.Add(false);
                    PozicijeVrata.Add(false);
                }

                foreach (DrawerDTO d in DrawersInBox)
                {
                    PozicijeFioka[d.pregrada] = true;
                }

                foreach (DoorDTO d in DoorsInBox)
                {
                    PozicijeVrata[d.pregrada] = true;
                }

                ObjectDTO o = new ObjectDTO()
                {
                    Width          = box.Width,
                    Height         = box.Height,
                    Depth          = box.Depth,
                    Name           = box.Name,
                    BoardThickness = box.BoardThickness,
                    PositionX      = box.PositionX,
                    PositionY      = box.PositionY,
                    PositionZ      = box.PositionZ,
                    Texture        = box.Texture,
                    childs         = BoardsInBox,
                    nizFioka       = DrawersInBox,
                    pozicije_fioka = PozicijeFioka,
                    nizVrata       = DoorsInBox,
                    pozicije_vrata = PozicijeVrata,
                    vertikalno     = box.vertikalno,
                    horizontalno   = box.horizontalno,
                    globalX        = box.globalX,
                    globalY        = box.globalY,
                    globalZ        = box.globalZ
                };

                objects.Add(o);
            }

            return(objects);
        }
예제 #4
0
        public virtual bool IsFinishedDraw()
        {
            if (Drawers.Any())
            {
                return(Drawers.Last().IsFinishedDraw());
            }

            return(true);
        }
예제 #5
0
 public void GeneratePairs()
 {
     if (Drawers.Where(d => d.Picked).Count() == 0)
     {
         return;
     }
     pair.Pair(Drawers.Where(d => d.Picked));
     LastGeneration = pair.LastGeneration;
 }
예제 #6
0
 void Awake()
 {
     _d = this;
     Switch(true);
     exchange = GetComponentInChildren <ExchangeZone>();
     drawers  = GameObject.Find("Drawers").GetComponent <Drawers>();
     arms     = transform.Find("Arms").GetComponent <RectTransform>();
     phone    = GameObject.FindObjectOfType <Phone>();
     radio    = GameObject.Find("radio").GetComponent <AudioSource>();
 }
예제 #7
0
 public Collideable()
 {
     Drawers.Add(new HitboxDrawer());
     Behaviors.Add(new SpawnOnRemovalBehavior {
         Prototype = new Decoration()
         {
             BaseTexture = "explosion", LengthMs = 600, LengthVariance = 300
         }, InheritSize = true
     });
     CollisionBoxScale = 1;
 }
예제 #8
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            var prop = Property as TriangleDrawProperty;

            if (prop == null)
            {
                return;
            }

            Drawers.Clear();

            var vertexAProp = new VertexDrawProperty();

            vertexAProp.Color    = prop.VertexAColor;
            vertexAProp.Position = prop.VertexA;
            Drawers.Add(new VertexDrawer(vertexAProp));

            var lineABDrawerProp = new LineDrawerProperty();

            lineABDrawerProp.Color       = prop.EdgeABColor;
            lineABDrawerProp.StartVertex = prop.VertexA;
            lineABDrawerProp.EndVertex   = prop.VertexB;
            Drawers.Add(new LineDrawer(lineABDrawerProp));

            var vertexBProp = new VertexDrawProperty();

            vertexBProp.Color    = prop.VertexAColor;
            vertexBProp.Position = prop.VertexB;
            Drawers.Add(new VertexDrawer(vertexBProp));

            var lineBCDrawerProp = new LineDrawerProperty();

            lineBCDrawerProp.Color       = prop.EdgeBCColor;
            lineBCDrawerProp.StartVertex = prop.VertexB;
            lineBCDrawerProp.EndVertex   = prop.VertexC;
            Drawers.Add(new LineDrawer(lineBCDrawerProp));

            var vertexCProp = new VertexDrawProperty();

            vertexCProp.Color    = prop.VertexCColor;
            vertexCProp.Position = prop.VertexC;
            Drawers.Add(new VertexDrawer(vertexCProp));

            var lineCADrawerProp = new LineDrawerProperty();

            lineCADrawerProp.Color       = prop.EdgeCAColor;
            lineCADrawerProp.StartVertex = prop.VertexC;
            lineCADrawerProp.EndVertex   = prop.VertexA;
            Drawers.Add(new LineDrawer(lineCADrawerProp));
        }
예제 #9
0
        public void AddNewGuestDrawer()
        {
            if (Drawers.Select(d => d.Name).Contains(NewGuestDrawer) || string.IsNullOrWhiteSpace(NewGuestDrawer))
            {
                return;
            }
            Drawers.Add(new Drawer(NewGuestDrawer,
                                   "https://i.imgur.com/EHWNFi5.png")
            {
                IsGuest = true
            });

            //PickedDrawers = new List<Drawer>();           //TU
        }
예제 #10
0
 public Player()
 {
     BaseTexture = "player_new";
     R           = 4 * textureScale;
     Behaviors.Add(controlBehavior);
     Behaviors.Add(new FramedMovementBehavior());
     Drawers.Add(manaDrawer);
     Drawers.Add(paybackDrawer);
     Health         = new Health(this, 9);
     Mana           = new Consumable(20);
     Payback        = new Consumable(1000);
     IsFriendly     = true;
     Mana.Amount    = 0;
     Payback.Amount = 0;
 }
예제 #11
0
        public bool Update(int currentFrame)
        {
            ShouldDraw = false;

            if (Life != 0 && Property.Delay <= currentFrame)
            {
                Life--;
                ShouldDraw = Life != 0;
            }

            var ret = ShouldDraw | OnUpdate(currentFrame);

            Drawers.ForEach(d => ret |= d.Update(currentFrame));

            return(ret);
        }
예제 #12
0
        public void SaveConfiguration(string ArrayOfObjects, int planId)
        {
            //List<ObjectDTO> objects = (List<ObjectDTO>)JsonSerializer.DeserializeFromString(ArrayOfObjects, typeof(List<ObjectDTO>));
            ObjectDTO o = (ObjectDTO)JsonSerializer.DeserializeFromString(ArrayOfObjects, typeof(ObjectDTO));
            //foreach (ObjectDTO o in objects)
            //{


            //}

            BoxDTO box = new BoxDTO()
            {
                PlanId         = planId,
                Width          = o.Width,
                Height         = o.Height,
                Depth          = o.Depth,
                BoardThickness = o.BoardThickness,
                PositionX      = o.PositionX,
                PositionY      = o.PositionY,
                PositionZ      = o.PositionZ,
                Name           = o.Name,
                Texture        = o.Texture,
                vertikalno     = o.vertikalno,
                horizontalno   = o.horizontalno,
                globalX        = o.globalX,
                globalY        = o.globalY,
                globalZ        = o.globalZ
            };

            int boxId = Boxs.Create(box);

            foreach (BoardDTO b in o.childs)
            {
                BoardDTO board = new BoardDTO()
                {
                    BoxId          = boxId,
                    Width          = b.Width,
                    Height         = b.Height,
                    Depth          = b.Depth,
                    BoardThickness = b.BoardThickness,
                    PositionX      = b.PositionX,
                    PositionY      = b.PositionY,
                    PositionZ      = b.PositionZ,
                    Name           = b.Name,
                    Texture        = b.Texture
                };

                int boardId = Boards.Create(board);
            }

            List <int> pozicije = new List <int>();

            if (o.pozicije_fioka != null)
            {
                for (int i = 0; i < o.childs.Count + 1; i++)
                {
                    if (o.pozicije_fioka[i] == true)
                    {
                        pozicije.Add(i);
                    }
                }
            }

            int k = 0;

            foreach (DrawerDTO d in o.nizFioka)
            {
                DrawerDTO drawer = new DrawerDTO()
                {
                    BoxId          = boxId,
                    Width          = d.Width,
                    Height         = d.Height,
                    Depth          = d.Depth,
                    BoardThickness = d.BoardThickness,
                    PositionX      = d.PositionX,
                    PositionY      = d.PositionY,
                    PositionZ      = d.PositionZ,
                    Name           = d.Name,
                    Texture        = d.Texture,
                    pregrada       = pozicije[k]
                };

                int drawerId = Drawers.Create(drawer);
                k++;
            }

            pozicije = new List <int>();
            if (o.pozicije_vrata != null)
            {
                for (int i = 0; i < o.childs.Count + 1; i++)
                {
                    if (o.pozicije_vrata[i] == true)
                    {
                        pozicije.Add(i);
                    }
                }
            }

            k = 0;

            foreach (DoorDTO d in o.nizVrata)
            {
                DoorDTO door = new DoorDTO()
                {
                    BoxId     = boxId,
                    Width     = d.Width,
                    Height    = d.Height,
                    Depth     = d.Depth,
                    PositionX = d.PositionX,
                    PositionY = d.PositionY,
                    PositionZ = d.PositionZ,
                    Name      = d.Name,
                    Texture   = d.Texture,
                    pregrada  = pozicije[k]
                };

                int doorId = Doors.Create(door);
                k++;
            }
        }
예제 #13
0
 private bool CanBeDrawn(IEditorDictionary dict)
 => Drawers.CanDraw(dict.KeyType) && Drawers.CanDraw(dict.ValueType);
예제 #14
0
 /// <summary>
 /// Add a new user to the lobby
 /// </summary>
 /// <param name="User">User object describing the new user</param>
 public void AddUser(User User)
 {
     Drawers.Add(User.SessionId, User);
 }