示例#1
0
        public void CaptureImage(float _scale, bool _save_file = false)
        {
            lock ( m_lock ) {
                try {
                    if (this.InvokeRequired)
                    {
                        var d = new delegate_CaptureImage(CaptureImage);
                        Invoke(d, _scale, _save_file);
                    }
                    else
                    {
                        eCaptureType type = eCaptureType.eCaptureType_Graphics;
                        switch (type)
                        {
                        case eCaptureType.eCaptureType_FormDrawToBitmap:
                            CaptureImage_FormDrawToBitmap(_scale, _save_file);
                            break;

                        case eCaptureType.eCaptureType_Win32_ScreenCapture:
                            CaptureImage_Win32_ScreenCapture(_scale, _save_file);
                            break;

                        case eCaptureType.eCaptureType_Graphics:
                            CaptureImage_Graphics(_scale, _save_file);
                            break;
                        }
                    }
                } catch (Exception ex) {
                    throw ex;
                }
            }
        }
示例#2
0
        public CaptureMission(eCaptureType type, object owner, string hint)
            : base(owner)
        {
            eRealm realm = eRealm.None;

            if (owner is Group group)
            {
                realm = group.Leader.Realm;
            }
            else if (owner is GamePlayer)
            {
                realm = ((GamePlayer)owner).Realm;
            }

            ArrayList list = new ArrayList();

            switch (type)
            {
            case eCaptureType.Tower:
            {
                ICollection <AbstractGameKeep> keeps;
                if (owner is Group group1)
                {
                    keeps = GameServer.KeepManager.GetKeepsOfRegion(group1.Leader.CurrentRegionID);
                }
                else if (owner is GamePlayer)
                {
                    keeps = GameServer.KeepManager.GetKeepsOfRegion(((GamePlayer)owner).CurrentRegionID);
                }
                else
                {
                    keeps = new List <AbstractGameKeep>();
                }

                foreach (AbstractGameKeep keep in keeps)
                {
                    if (keep.IsPortalKeep)
                    {
                        continue;
                    }

                    if (keep is GameKeepTower && keep.Realm != realm)
                    {
                        list.Add(keep);
                    }
                }

                break;
            }

            case eCaptureType.Keep:
            {
                ICollection <AbstractGameKeep> keeps;
                if (owner is Group group1)
                {
                    keeps = GameServer.KeepManager.GetKeepsOfRegion(group1.Leader.CurrentRegionID);
                }
                else if (owner is GamePlayer gOwner)
                {
                    keeps = GameServer.KeepManager.GetKeepsOfRegion(gOwner.CurrentRegionID);
                }
                else
                {
                    keeps = new List <AbstractGameKeep>();
                }

                foreach (AbstractGameKeep keep in keeps)
                {
                    if (keep.IsPortalKeep)
                    {
                        continue;
                    }

                    if (keep is GameKeep && keep.Realm != realm)
                    {
                        list.Add(keep);
                    }
                }

                break;
            }
            }

            if (list.Count > 0)
            {
                if (hint != string.Empty)
                {
                    foreach (AbstractGameKeep keep in list)
                    {
                        if (keep.Name.ToLower().Contains(hint))
                        {
                            _keep = keep;
                            break;
                        }
                    }
                }

                if (_keep == null)
                {
                    _keep = list[Util.Random(list.Count - 1)] as AbstractGameKeep;
                }
            }

            GameEventMgr.AddHandler(KeepEvent.KeepTaken, new DOLEventHandler(Notify));
        }
示例#3
0
		public CaptureMission(eCaptureType type, object owner, string hint)
			: base(owner)
		{
			eRealm realm = eRealm.None;
			if (owner is Group)
				realm = (owner as Group).Leader.Realm;
			else if (owner is GamePlayer)
				realm = (owner as GamePlayer).Realm;

			ArrayList list = new ArrayList();

			switch (type)
			{
				case eCaptureType.Tower:
					{
						ICollection<AbstractGameKeep> keeps;
						if (owner is Group)
							keeps = KeepMgr.GetKeepsOfRegion((owner as Group).Leader.CurrentRegionID);
						else if (owner is GamePlayer)
							keeps = KeepMgr.GetKeepsOfRegion((owner as GamePlayer).CurrentRegionID);
						else keeps = new List<AbstractGameKeep>();

						foreach (AbstractGameKeep keep in keeps)
						{
							if (keep.IsPortalKeep)
								continue;
							if (keep is GameKeepTower && keep.Realm != realm)
								list.Add(keep);
						}
						break;
					}
				case eCaptureType.Keep:
					{
						ICollection<AbstractGameKeep> keeps;
						if (owner is Group)
							keeps = KeepMgr.GetKeepsOfRegion((owner as Group).Leader.CurrentRegionID);
						else if (owner is GamePlayer)
							keeps = KeepMgr.GetKeepsOfRegion((owner as GamePlayer).CurrentRegionID);
						else keeps = new List<AbstractGameKeep>();

						foreach (AbstractGameKeep keep in keeps)
						{
							if (keep.IsPortalKeep)
								continue;
							if (keep is GameKeep && keep.Realm != realm)
								list.Add(keep);
						}
						break;
					}
			}

			if (list.Count > 0)
			{
				if (hint != "")
				{
					foreach (AbstractGameKeep keep in list)
					{
						if (keep.Name.ToLower().Contains(hint))
						{
							m_keep = keep;
							break;
						}
					}
				}

				if (m_keep == null)
					m_keep = list[Util.Random(list.Count - 1)] as AbstractGameKeep;
			}

			GameEventMgr.AddHandler(KeepEvent.KeepTaken, new DOLEventHandler(Notify));
		}