Inheritance: MonoBehaviour
示例#1
0
    //Tool LastTool = Tool.None;

    void OnEnable()
    {
        myTarget = (Portal)target;

        //LastTool = Tools.current;
        //Tools.current = Tool.None;
    }
示例#2
0
        /// <summary>
        /// Change the current map, arriving at the given portal if any.
        /// </summary>
        /// <param name="contentName">The asset name of the new map.</param>
        /// <param name="originalPortal">The portal from the previous map.</param>
        public static void ChangeMap(string contentName, Portal originalPortal)
        {
            // make sure the content name is valid
            string mapContentName = contentName;
            if (!mapContentName.StartsWith(@"Maps\"))
            {
                mapContentName = Path.Combine(@"Maps", mapContentName);
            }

            // check for trivial movement - typically intra-map portals
            if ((TileEngine.Map != null) && (TileEngine.Map.AssetName == mapContentName))
            {
                TileEngine.SetMap(TileEngine.Map, originalPortal == null ? null :
                    TileEngine.Map.FindPortal(originalPortal.DestinationMapPortalName));
            }

            // load the map
            ContentManager content = singleton.screenManager.Game.Content;
            Map map = content.Load<Map>(mapContentName).Clone() as Map;

            // modify the map based on the world changes (removed chests, etc.).
            singleton.ModifyMap(map);

            // start playing the music for the new map
            AudioManager.PlayMusic(map.MusicCueName);

            // set the new map into the tile engine
            TileEngine.SetMap(map, originalPortal == null ? null :
                map.FindPortal(originalPortal.DestinationMapPortalName));
        }
示例#3
0
 /// <summary>
 /// 
 /// </summary>
 public ImageTools(Portal.API.Module m)
 {
   currentModule = m;
   cfg = (ImageBrowserConfig)currentModule.ReadConfig(typeof(ImageBrowserConfig));
   if(cfg == null)
     cfg = new ImageBrowserConfig();
 }
示例#4
0
文件: Portal.cs 项目: steveimc/Rawr
    private void OnTriggerEnter2D(Collider2D col2D)
    {
        if(!m_bTeleport)
            return;

        if(col2D.gameObject.GetComponent<HeroStatus>() && m_HeroCanTeleport)
        {
            m_linkedPortal.SetTeleport(false);
            col2D.transform.position = m_linkedPortal.transform.position;
        }
        else if(col2D.gameObject.GetComponent<EnemySlug>())
        {
            int iRandom = SelectRandom();

            if(m_linkedPortal)
            {
                m_linkedPortal.GetComponentInChildren<ParticleSystem>().Play();
                m_linkedPortal.m_HeroCanTeleport = false;
            }
            m_Portals[iRandom].GetComponentInChildren<ParticleSystem>().Play();
            this.GetComponentInChildren<ParticleSystem>().Play();

            m_HeroCanTeleport = true;
            m_Portals[iRandom].m_HeroCanTeleport = true;

            m_linkedPortal = m_Portals[iRandom];
            m_Portals[iRandom].m_linkedPortal = this;

            m_linkedPortal.SetTeleport(false);

            Invoke("DisablePortals",LIFETIME);
            col2D.transform.position = m_linkedPortal.transform.position;
            col2D.transform.rotation = m_linkedPortal.transform.rotation;
        }
    }
示例#5
0
 public Section(Portal portal, string host, string relativeUrl, string description)
 {
     Portal = portal;
     Host = host;
     RelativeUrl = relativeUrl;
     Description = description;
 }
 public PortalGun(String Name, String ModelName, Model SentModel, Vector3 ModelPosition, Vector3 ModelRotation, GraphicsDevice device)
     : base(Name, ModelName, SentModel, ModelPosition, ModelRotation, device, true, true, 0f, false)
 {
     ActionString = "PortalGun";
     //constructs the portal gun
     Blue = new Portal();
     Orange = new Portal();
 }
示例#7
0
        public static void init()
        {
            Login = new Portal(100);
            Chat = new Portal(101);

            PColl = new PortalCollection();
            PColl.RegisterPortal(Login);
            PColl.RegisterPortal(Chat);
        }
示例#8
0
 public RaceViewModel(Portal.Models.SubEvent s, Portal.Models.OfficialEvent competition)
 {
     Name = competition.Title;
     Logo = "http://www.rallysportphoto.net/file/" + s.Logo.FileName;
     Map = "http://www.rallysportphoto.net/file/" + s.Map.FileName;
     EmergencyPhone = competition.EmergencyPhone;
     Status = s.Title;
     Free = true;
     Id = s.SecondaryId.GetValueOrDefault();
 }
示例#9
0
    void Update()
    {
        if(gameObject.tag == "PortalA"){
            otherPortal = (Portal)GameObject.FindWithTag("PortalB").GetComponent("Portal");
        }

        if(gameObject.tag == "PortalB"){
            otherPortal =(Portal)GameObject.FindWithTag("PortalA").GetComponent("Portal");
        }
    }
示例#10
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     Portal p = new Portal();
     SelectedPortal = p;
     p.Name = "New Portal " + lstPortals.Items.Count.ToString();
     txtPortalName.Text = "New Portal " + lstPortals.Items.Count.ToString();
     CurrentMap.ContentMap.Portals.Add(p);
     LoadPortalList();
     lstPortals.SelectedValue = p.Name;
 }
示例#11
0
 public ActionResult BannerPublicidadeRotativo(Portal model)
 {
     if (model != null)
     {
         return View(model);
     }
     else
     {
         return View();
     }
 }
示例#12
0
 public ActionResult Agenda(Portal model)
 {
     if (model != null)
     {
         return View(model);
     }
     else
     {
         return View();
     }
 }
示例#13
0
        private static void Main()
        {
            Portal me = new Portal(new MyOpenBook("Judith"));
            me.Add("Hello World");
            me.Add("Today I worked 18 hours.");

            Portal tom = new Portal(new MyOpenBook("Tom"));
            tom.Poke("Judith-1");
            tom.MessageFriend("Judith-1", "Poor You");
            tom.Add("Hey, I'm on OpenBook - it's cool");
        }
示例#14
0
文件: Portal.cs 项目: craus/UnityTest
 public void Disconnect()
 {
     if (other == null) {
         return;
     }
     other.other = null;
     other.Switch(false);
     other = null;
     Switch(false);
     Debug.LogFormat("Disconnected");
 }
示例#15
0
文件: Portal.cs 项目: craus/UnityTest
 public void Connect(Portal other)
 {
     if (this.other == other) {
         return;
     }
     Disconnect();
     other.other = this;
     this.other = other;
     Switch(true);
     other.Switch(true);
     Debug.LogFormat("Connected");
 }
示例#16
0
 /// <summary>
 /// Try to find a portal with the specified sourcezone and specified target zone.
 /// </summary>
 /// <param name="TargetZone">Desired mapid</param>
 /// <param name="SourceZone">Current mapid</param>
 /// <param name="portal">Potal information</param>
 /// <returns>True if the portal was found</returns>
 public bool TryFind(byte TargetZone, byte SourceZone, out Portal portal)
 {
     try
     {
         portal = portals[SourceZone][TargetZone];
         return true;
     }
     catch (Exception)
     {
         portal = new Portal();
         return false;
     }
 }
        public ActionResult Index(int AssociadoCategoriaId)
        {
            Portal model = new Portal().CarregarModel();

            model.AssociadoCategoriaId = AssociadoCategoriaId;

            if (AssociadoCategoriaId == 1) model.AssociadoCategoria = "Associados";
            if (AssociadoCategoriaId == 2) model.AssociadoCategoria = "Árbitros";
            if (AssociadoCategoriaId == 3) model.AssociadoCategoria = "Mediadores";

            model.Titulo = model.AssociadoCategoria;

            return View(model);
        }
示例#18
0
 public CarResultItem(Portal.Models.Order o)
 {
     try
     {
         StartNumber = int.Parse(o.StartNumber);
     }
     catch {
         StartNumber = 999;
     }
     if(o.Driver !=null)
         Driver = (o.Driver.LastName ?? "").ToUpper() + " " + o.Driver.FirstName;
     if(o.CoDriver!=null)
         CoDriver= (o.CoDriver.LastName ?? "").ToUpper() + " " + o.CoDriver.FirstName;
     StageResults = new List<StageResult>();
 }
示例#19
0
	void Start()
	{
		state = PortalState.Open;

		if (listPortals == null)
		{
			listPortals = GameObject.FindGameObjectsWithTag("portal");
		}
		

		for (int i = 0; i < listPortals.Length; i++)
		{
			if (listPortals[i].GetInstanceID() != gameObject.GetInstanceID())
			{
				m_Linked = listPortals[i].GetComponent<Portal>();
				break;
			}
		}
	}
示例#20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (SelectedPortal == null ||
                String.IsNullOrEmpty(SelectedPortal.Name))
                SelectedPortal = new Portal();
            SelectedPortal.Name = txtPortalName.Text;
            SelectedPortal.ToMapName = txtDestinationMapName.Text;
            SelectedPortal.ToPortalName = txtDestinationPortalName.Text;
            int x = 0;
            int y = 0;
            Int32.TryParse(cbCoordsX.Text, out x);
            Int32.TryParse(cbCoordsY.Text, out y);
            SelectedPortal.Coordinates = new Microsoft.Xna.Framework.Point(x*32, y*32);
            SelectedPortal.Direction = cbDirection.Text;
            if (CurrentMap.ContentMap.Portals.Exists(p => p.Name == SelectedPortal.Name))
            {
                Portal removeP = CurrentMap.ContentMap.Portals.First(p => p.Name == SelectedPortal.Name);
                CurrentMap.ContentMap.Portals.Remove(removeP);

            }
            CurrentMap.ContentMap.Portals.Add(SelectedPortal);
        }
示例#21
0
        //
        // GET: /Conteudo/
        public ActionResult Index(int? Id)
        {
            Portal model = new Portal().CarregarModel();

            if (Id != null)
            {
                model.Conteudo = model.Eventos.Find(x => x.PublicacaoId == Id);
                if (model.Conteudo == null)
                    model.Conteudo = model.Noticias.Find(x => x.PublicacaoId == Id);
                if (model.Conteudo == null)
                    model.Conteudo = model.Materias.Find(x => x.PublicacaoId == Id);
                if (model.Conteudo == null)
                    model.Conteudo = model.Artigos.Find(x => x.PublicacaoId == Id);
                if (model.Conteudo == null)
                    model.Conteudo = model.Paginas.Find(x => x.PublicacaoId == Id);

                model.CarregarMenuInterna((int)Id);
                if (model.Conteudo != null) model.CarregarMenuTree((int)Id);

                model.CarregarBannerInterna((int)Id);
            }

            return View(model);
        }
 public HomeViewModel()
 {
     Posts  = new List <Post>();
     Portal = new Portal();
 }
示例#23
0
 private bool IsPassable(Portal p)
 {
     return this.IsFree(p.LinkedSquares.First) && IsFree(p.LinkedSquares.Second);
 }
示例#24
0
 public void PortalExistsTest()
 {
     portal = new Portal ();
     Assert.AreEqual ("Portal", portal.Tag);
 }
示例#25
0
	protected override void StartScene ()
	{
		base.StartScene ();
		portal = FindObjectOfType<Portal> ();
		portal.IsEnabled = false;
	}
示例#26
0
    /// <summary>
    /// Add a portal to the portal group.
    /// </summary>
    /// <param name="p">
    /// The portals to add.
    /// </param>
    public void Add(Portal p)
    {
        if (p == null)
        {
            throw new ArgumentNullException("p");
        }

        if (portals.Contains(p))
        {
            return;
        }

        this.portals.Add(p);
        var midP = p.MidPoint;

        // Debug.Log("ADD: " + midP);
        if (this.First.x < 0 && this.Last.x < 0)
        {
            this.First = midP;
            this.Last = midP;
        }
        else
        {
            if (Math.Abs(midP.y - this.Last.y) < 0.01)
            {
                if (midP.x < this.First.x)
                {
                    this.First = midP;
                    return;
                }

                if (midP.x > this.Last.x)
                {
                    this.Last = midP;
                }
            }
            else
            {
                if (midP.y < this.First.y)
                {
                    this.First = midP;
                    return;
                }

                if (midP.y > this.Last.y)
                {
                    this.Last = midP;
                }
            }
        }
    }
示例#27
0
        protected override void HandlePacket(Client client, UsePortalPacket packet)
        {
            if (client.Player.Owner == null)
            {
                return;
            }

            client.Manager.Logic.AddPendingAction(t =>
            {
                Portal portal = client.Player.Owner.GetEntity(packet.ObjectId) as Portal;
                if (portal == null)
                {
                    return;
                }
                if (!portal.Usable)
                {
                    client.Player.SendError("{\"key\":\"server.realm_full\"}");
                    return;
                }
                World world = portal.WorldInstance;

                if (world == null)
                {
                    bool setWorldInstance = true;
                    var desc = portal.ObjectDesc;
                    if (desc == null)
                    {
                        client.SendPacket(new FailurePacket
                        {
                            ErrorId          = 0,
                            ErrorDescription = "Portal not found!"
                        });
                    }
                    else
                    {
                        switch (portal.ObjectType)
                        {
                        case 0x0720:
                            world            = client.Player.Manager.PlayerVault(client);
                            setWorldInstance = false;
                            break;

                        case 0x0704:
                        case 0x0703:     //portal of cowardice
                        case 0x0d40:
                        case 0x070d:
                        case 0x070e:
                            {
                                if (client.Player.Manager.LastWorld.ContainsKey(client.Player.AccountId))
                                {
                                    World w = client.Player.Manager.LastWorld[client.Player.AccountId];
                                    if (w != null && client.Player.Manager.Worlds.ContainsKey(w.Id))
                                    {
                                        world = w;
                                    }
                                    else
                                    {
                                        world = client.Player.Manager.GetWorld(World.NEXUS_ID);
                                    }
                                }
                                else
                                {
                                    world = client.Player.Manager.GetWorld(World.NEXUS_ID);
                                }
                                setWorldInstance = false;
                            }
                            break;

                        case 0x0750:
                            world = client.Player.Manager.GetWorld(World.MARKET);
                            break;

                        case 0x071d:
                            world = client.Player.Manager.GetWorld(World.NEXUS_ID);
                            break;

                        case 0x0753:
                            world            = client.Manager.AddWorld(new PetYard(client.Player));
                            setWorldInstance = false;
                            break;

                        case 0x0712:
                            world = client.Player.Manager.GetWorld(World.NEXUS_ID);
                            break;

                        case 0x1756:
                            world = client.Player.Manager.GetWorld(World.DAILY_QUEST_ID);
                            break;

                        case 0x072f:
                            if (client.Player.Guild != null)
                            {
                                //client.Player.SendInfo(
                                //    "Sorry, you are unable to enter the GuildHall because of a possible memory leak, check back later");
                                //client.Player.SendInfo("Thanks.");
                                world = client.Player.Guild.GuildHall;
                            }
                            break;

                        default:
                            Type worldType =
                                Type.GetType("wServer.realm.worlds." +
                                             desc.DungeonName.Replace(" ", String.Empty).Replace("'", String.Empty));
                            if (worldType != null)
                            {
                                try
                                {
                                    world = client.Manager.AddWorld((World)Activator.CreateInstance(worldType,
                                                                                                    System.Reflection.BindingFlags.CreateInstance, null, null,
                                                                                                    CultureInfo.InvariantCulture, null));
                                }
                                catch (Exception ex)
                                {
                                    client.Player.SendError("Error while creating world instance:");
                                    client.Player.SendError(ex.ToString());
                                    log.Error(ex);
                                }
                            }
                            else
                            {
                                client.Player.SendError("WorldClass for " + desc.DungeonName +
                                                        " not found, can not load world.");
                            }
                            break;
                        }
                    }
                    if (setWorldInstance)
                    {
                        portal.WorldInstance = world;
                    }
                }

                if (world != null)
                {
                    if (world.IsFull)
                    {
                        client.Player.SendError("{\"key\":\"server.dungeon_full\"}");
                        return;
                    }

                    if (client.Player.Manager.LastWorld.ContainsKey(client.Player.AccountId))
                    {
                        World dummy;
                        client.Player.Manager.LastWorld.TryRemove(client.Player.AccountId, out dummy);
                    }
                    if (client.Player.Owner is Nexus || client.Player.Owner is GameWorld)
                    {
                        client.Player.Manager.LastWorld.TryAdd(client.Player.AccountId, client.Player.Owner);
                    }

                    client.Reconnect(new ReconnectPacket
                    {
                        Host   = "",
                        Port   = Program.Settings.GetValue <int>("port"),
                        GameId = world.Id,
                        Name   = world.Name,
                        Key    = world.PortalKey,
                    });
                }
            }, PendingPriority.Networking);
        }
示例#28
0
        /// <summary>
        /// Query service POST
        /// </summary>
        /// <param name="portal">Portal</param>
        /// <returns>Portal response</returns>
        private async Task <PortalResponse> QueryServicePostAsync(Portal portal)
        {
            Stopwatch      timer          = new Stopwatch();
            PortalResponse portalResponse = new PortalResponse();

            portalResponse.RequestDateTime = DateTime.UtcNow;

            if (portal.Type == PortalType.ServiceSOAP)
            {
                var xml     = XElement.Parse(portal.Parameters).ToString();
                var content = new StringContent(xml, Encoding.UTF8, "application/xml");

                try
                {
                    timer.Start();
                    var post = await _http.PostAsync(portal.URL, content);

                    timer.Stop();

                    var response     = post.StatusCode;
                    int responseTime = (int)timer.ElapsedMilliseconds;

                    portalResponse.Status       = (int)response;
                    portalResponse.ResponseTime = responseTime;
                    portalResponse.StatusPageId = portal.Id;
                    portalResponse.StatusPage   = portal;

                    await WriteLastResponseData(portal, portalResponse);

                    if (portalResponse.Status < 200 || portalResponse.Status > 299)
                    {
                        portalResponse.ErrorMessage = post.ToString();
                        await WriteBadResponseAsync(portalResponse, portal.Id);
                    }

                    return(portalResponse);
                }
                catch (HttpRequestException e)
                {
                    portalResponse.ErrorMessage = e.Message;
                    await WriteBadResponseAsync(portalResponse, portal.Id);

                    return(portalResponse);
                }
                catch (Exception ex)
                {
                    portalResponse.ErrorMessage = ex.Message;
                    await WriteBadResponseAsync(portalResponse, portal.Id);

                    return(portalResponse);
                }
            }
            else
            {
                var content = new StringContent(portal.Parameters, Encoding.UTF8, "application/json");

                try
                {
                    timer.Start();
                    var post = await _http.PostAsync(portal.URL, content);

                    timer.Stop();

                    var response     = post.StatusCode;
                    int responseTime = (int)timer.ElapsedMilliseconds;

                    portalResponse.Status       = (int)response;
                    portalResponse.ResponseTime = responseTime;
                    portalResponse.StatusPageId = portal.Id;
                    portalResponse.StatusPage   = portal;

                    await WriteLastResponseData(portal, portalResponse);

                    if (portalResponse.Status < 200 || portalResponse.Status > 299)
                    {
                        portalResponse.ErrorMessage = post.ToString();
                        await WriteBadResponseAsync(portalResponse, portal.Id);
                    }

                    return(portalResponse);
                }
                catch (HttpRequestException e)
                {
                    portalResponse.ErrorMessage = e.Message;
                    await WriteBadResponseAsync(portalResponse, portal.Id);

                    return(portalResponse);
                }
                catch (Exception ex)
                {
                    portalResponse.ErrorMessage = ex.Message;
                    await WriteBadResponseAsync(portalResponse, portal.Id);

                    return(portalResponse);
                }
            }
        }
示例#29
0
 public void Awake()
 {
     otherPortalScript = otherPortal.GetComponent<Portal>();
 }
示例#30
0
 public static bool IsCurrentlySummoning(this Portal portal, string creatureType)
 {
     return(portal.CurrentlySummoning == creatureType);
 }
示例#31
0
    private Vector3 ComputeSpawnPosition(Portal currentPortal)
    {
        const float offsetX      = 0.8f;
        const float offsetY      = 1.3f;
        const float checkOffsetX = 0.75f;
        const float checkOffsetY = 1.25f;

        var mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        mousePosition.z = 0;
        var spawnPosition = mousePosition;

        var predicate = currentPortal == Portal.Blue ? wallsAndRedPortalPredicate : wallsAndBluePortalPredicate;

        var upHit = Physics2D.RaycastAll(mousePosition, Vector2.up, offsetY)
                    .FirstOrDefault(predicate);
        var downHit = Physics2D.RaycastAll(mousePosition, Vector2.down, offsetY)
                      .FirstOrDefault(predicate);
        var rightHit = Physics2D.RaycastAll(mousePosition, Vector2.right, offsetX)
                       .FirstOrDefault(predicate);
        var leftHit = Physics2D.RaycastAll(mousePosition, Vector2.left, offsetX)
                      .FirstOrDefault(predicate);

        if (upHit.collider != null)
        {
            spawnPosition.y -= mousePosition.y + offsetY - upHit.collider.bounds.min.y;
        }
        if (downHit.collider != null)
        {
            spawnPosition.y += downHit.collider.bounds.max.y - (mousePosition.y - offsetY);
        }
        if (rightHit.collider != null)
        {
            spawnPosition.x -= mousePosition.x + offsetX - rightHit.collider.bounds.min.x;
        }
        if (leftHit.collider != null)
        {
            spawnPosition.x += leftHit.collider.bounds.max.x - (mousePosition.x - offsetX);
        }

        var diagDistance   = Math.Sqrt(Math.Pow(checkOffsetX, 2) + Math.Pow(checkOffsetY, 2)) * 0.75f;
        var diagUpRightHit = Physics2D.RaycastAll(spawnPosition, Vector2.up + Vector2.right, (float)diagDistance)
                             .FirstOrDefault(predicate);

        if (diagUpRightHit.collider != null)
        {
            spawnPosition.y -= spawnPosition.y + offsetY - diagUpRightHit.collider.bounds.min.y;
            spawnPosition.x -= spawnPosition.x + offsetX - diagUpRightHit.collider.bounds.min.x;
        }

        var diagUpLeftHit = Physics2D.RaycastAll(spawnPosition, Vector2.up + Vector2.left, (float)diagDistance)
                            .FirstOrDefault(predicate);

        if (diagUpLeftHit.collider != null)
        {
            spawnPosition.y -= spawnPosition.y + offsetY - diagUpLeftHit.collider.bounds.min.y;
            spawnPosition.x += diagUpLeftHit.collider.bounds.max.x - (spawnPosition.x - offsetX);
        }

        var diagDownRightHit = Physics2D.RaycastAll(spawnPosition, Vector2.down + Vector2.right, (float)diagDistance)
                               .FirstOrDefault(predicate);

        if (diagDownRightHit.collider != null)
        {
            spawnPosition.y += diagDownRightHit.collider.bounds.max.y - (spawnPosition.y - offsetY);
            spawnPosition.x -= spawnPosition.x + offsetX - diagDownRightHit.collider.bounds.min.x;
        }

        var diagDownLeftHit = Physics2D.RaycastAll(spawnPosition, Vector2.down + Vector2.left, (float)diagDistance)
                              .FirstOrDefault(predicate);

        if (diagDownLeftHit.collider != null)
        {
            spawnPosition.y += diagDownLeftHit.collider.bounds.max.y - (spawnPosition.y - offsetY);
            spawnPosition.x += diagDownLeftHit.collider.bounds.max.x - (spawnPosition.x - offsetX);
        }

        return(Vector2.Distance(mousePosition, spawnPosition) > 3 ? Vector3.negativeInfinity : spawnPosition);
    }
    private void PortalableObjectOnHasTeleported(Portal sender, Portal destination, Vector3 newposition, Quaternion newrotation)
    {
        // For character controller to update

        Physics.SyncTransforms();
    }
示例#33
0
        /// <summary>
        /// The recursion algorithm: go through the rooms with portal-frustum occlusion test.
        /// </summary>
        /// <param name="portal">Portal we entered to the room through</param>
        /// <param name="frus">Frustum that intersects the portal</param>
        /// <returns>Number of added rooms</returns>
        public int ProcessRoom(Portal portal, Frustum frus)
        {
            var destination = portal.DestRoom;
            var current = portal.CurrentRoom;

            if(current == null || !current.Active || destination == null || !destination.Active)
            {
                return 0;
            }

            var ret = 0;
            foreach (var p in destination.Portals)
            {
                if(p.DestRoom != null && p.DestRoom.Active && p.DestRoom != current)
                {
                    // The main function of portal renderer. Here comes the check.
                    var genFrus = Frustum.PortalFrustumIntersect(p, frus, this);
                    if(genFrus != null)
                    {
                        ret++;
                        AddRoom(p.DestRoom);
                        ProcessRoom(p, genFrus);
                    }
                }
            }
            return ret;
        }
示例#34
0
        public void DrawPortal(Portal p)
        {
            for (var i = 0; i < p.Vertices.Count - 1; i++)
            {
                addLine(p.Vertices[i], p.Vertices[i + 1]);
            }

            addLine(p.Vertices.Last(), p.Vertices.First());
        }
        private void ReadDataFromRouteData()
        {
            try
            {
                if (RouteData.Values["clientId"].GetType() == typeof(System.Int32))
                {
                    clientId = (int)RouteData.Values["clientId"];
                }
                else
                {
                    clientId = int.Parse((string)RouteData.Values["clientId"]);
                }

                if (RouteData.Values["portalId"].GetType() == typeof(System.Int32))
                {
                    portalId = (int)RouteData.Values["portalId"];
                }
                else
                {
                    portalId = int.Parse((string)RouteData.Values["portalId"]);
                }
                _user = HttpContext.Session.GetUser(portalId);
                _portal = Session.GetPortalSessions().GetPortalSession(portalId,clientId).Portal;
                _searchesManager.Portal = _portal;
                _searchesManager.User = _user;
                //resource object
                Resources = Session.Resource(portalId, clientId, "search", _portal.Language.Name);
                CommonResources = Session.Resource(portalId, clientId, "common", _portal.Language.Name);
                ViewData["CommonViewModel"] = Utilities.CreateCommonViewModel(clientId, portalId, this._portal.PortalType, this._portal.Configuration,"article");
                headerVM = ((CommonViewModel)ViewData["CommonViewModel"]).HeaderViewModel;
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error:" + " " + ex.Message, ex);
                throw ex;
            }
        }
        private void ReadDataFromRouteData()
        {
            if (RouteData.Values["clientId"].GetType() == typeof(System.Int32))
            {
                clientId = (int)RouteData.Values["clientId"];
            }
            else
            {
                clientId = int.Parse((string)RouteData.Values["clientId"]);
            }

            if (RouteData.Values["portalId"].GetType() == typeof(System.Int32))
            {
                portalId = (int)RouteData.Values["portalId"];
            }
            else
            {
                portalId = int.Parse((string)RouteData.Values["portalId"]);
            }
            _user = HttpContext.Session.GetUser(portalId);
            _portal = Session.GetPortalSessions().GetPortalSession(portalId, clientId).Portal;
            _articleManager.Portal = _portal;
            _articleManager.User = _user;
            resources = Session.Resource(portalId, clientId, "ARTICLE", _portal.Language.Name);
            CommonResources = Session.Resource(portalId, clientId, "common", _portal.Language.Name);
            ViewData["CommonViewModel"] = Utilities.CreateCommonViewModel(clientId, portalId, this._portal.PortalType, this._portal.Configuration, "article");
            headerVM = ((CommonViewModel)ViewData["CommonViewModel"]).HeaderViewModel;
        }
 public void EndTournament()
 {
     Portal.EndTournament(tournamentId);
 }