Exemplo n.º 1
0
        public ArrowControl CreateArrow(ViewModel.Relationship viewModelRelationship)
        {
            if (viewModelRelationship.From == Guid.Empty || viewModelRelationship.To == Guid.Empty)
            {
                return(null);
            }



            if (Arrows.ContainsKey(viewModelRelationship.Id))
            {
                return(null);
            }
            if (IsArrowExist(viewModelRelationship.From, viewModelRelationship.To))
            {
                return(null);
            }
            var fromControl = NodeFactory.FindNodeControl(viewModelRelationship.From);
            var toControl   = NodeFactory.FindNodeControl(viewModelRelationship.To);

            if (fromControl == null || toControl == null)
            {
                PendingRelationships[viewModelRelationship.Id] = viewModelRelationship;
                return(null);
            }



            var set = CreateSet(viewModelRelationship, fromControl, toControl);

            Arrows[viewModelRelationship.Id] = set;
            return(set.Control);
        }
Exemplo n.º 2
0
        public ArrowControlFactorySet RemoveArrow(Guid relationshipId)
        {
            ArrowControlFactorySet set = null;

            if (Arrows.ContainsKey(relationshipId))
            {
                set = Arrows[relationshipId];
                Arrows.Remove(relationshipId);
                set.Control.UnlinkRelatedNodeControls();
            }

            return(set);
        }
Exemplo n.º 3
0
        private void LoadFileContainers()
        {
            foreach (var path in FilesContainerPath)
            {
                FileContainer obj = Resources.Load <FileContainer>(path);

                if (Arrows.ContainsKey(obj.name))
                {
                    throw new System.Exception($"存在重名文件{obj.name}!");
                }

                FileContainers.Add(obj.name, obj);
            }
        }
Exemplo n.º 4
0
        private void LoadArrows()
        {
            foreach (var path in ArrowsPath)
            {
                Arrow obj = Resources.Load <Arrow>(path);

                if (Arrows.ContainsKey(obj.name))
                {
                    throw new System.Exception($"存在重名文件{obj.name}!");
                }

                Arrows.Add(obj.name, obj);
            }
        }
Exemplo n.º 5
0
        public void TakeString(string Arrow, string Drop, string Player)
        {
            var           arr    = Arrow.Split(',');
            HashSet <int> IsUsed = new HashSet <int>();

            for (int i = 0; i < arr.Length; i++)
            {
                var small = arr[i].Split(' ');
                int tag   = Utily.Parse(small[0]);
                int dmg   = Utily.Parse(small[1]);
                int id    = Utily.Parse(small[2]);
                if (Arrows.ContainsKey(tag))
                {
                    Arrows[tag].dmg = dmg;
                    Arrows[tag].id  = id;
                }
                else
                {
                    Arrows.Add(tag, new AArrow(dmg, id));
                    ArrowEvent.Enqueue(tag);
                }
                IsUsed.Add(tag);
            }
            List <int> ForRemove = new List <int>();

            foreach (var i in Arrows)
            {
                if (!IsUsed.Contains(i.Key))
                {
                    ForRemove.Add(i.Key);
                    ArrowEvent.Enqueue(-i.Key);
                }
            }
            foreach (var i in ForRemove)
            {
                Arrows.Remove(i);
            }

            var dro = Drop.Split(',');

            IsUsed.Clear();
            for (int i = 0; i < arr.Length; i++)
            {
                var small = dro[i].Split(' ');
                int tag   = Utily.Parse(small[0]);
                int cnt   = Utily.Parse(small[1]);
                int id    = Utily.Parse(small[2]);
                if (Drops.ContainsKey(tag))
                {
                    Drops[tag].Count = cnt;
                    Drops[tag].id    = id;
                }
                else
                {
                    Drops.Add(tag, new ADrop(cnt, id));
                    DropEvent.Enqueue(tag);
                }
                IsUsed.Add(tag);
            }
            ForRemove.Clear();
            foreach (var i in Drops)
            {
                if (!IsUsed.Contains(i.Key))
                {
                    ForRemove.Add(i.Key);
                    DropEvent.Enqueue(-i.Key);
                }
            }
            foreach (var i in ForRemove)
            {
                Drops.Remove(i);
            }

            var pla = Player.Split(',');

            IsUsed.Clear();
            for (int i = 0; i < arr.Length; i++)
            {
                var small = pla[i].Split(' ');
                int tag   = Utily.Parse(small[0]);
                int kill  = Utily.Parse(small[1]);
                int death = Utily.Parse(small[2]);
                if (ArenaPlayer.ContainsKey(tag))
                {
                    ArenaPlayer[tag].RealName = small[3];
                    IsUsed.Add(tag);
                }
                else
                {
                    ArenaPlayer.Add(tag, new APlayer(small[3]));
                }
                ArenaPlayer[tag].Kill  = kill;
                ArenaPlayer[tag].Death = death;
            }
            ForRemove.Clear();
            foreach (var i in ArenaPlayer)
            {
                if (!IsUsed.Contains(i.Key))
                {
                    ForRemove.Add(i.Key);
                }
            }
            foreach (var i in ForRemove)
            {
                ArenaPlayer.Remove(i);
            }
        }
Exemplo n.º 6
0
 public Arrow GetArrow(string name)
 {
     return(Arrows.ContainsKey(name) ? Arrows[name] : null);
 }