/// <summary>Retorna o Ruler da sessão sem lançar excepção</summary> protected Ruler getRulerSafe() { User user = Page.User as User; if (user == null) { return(null); } Chronos.Core.Ruler ruler = Universe.instance.getRuler(user.RulerId); return(ruler); }
/// <summary>Retorna o Ruler da sessão</summary> protected Ruler getRuler() { User user = Page.User as User; if (user == null) { OrionGlobals.forceLogin(); return(null); } Chronos.Core.Ruler ruler = Universe.instance.getRuler(user.RulerId); if (ruler == null) { throw new AlnitakException("Ruler não existe @ PlanetControl::getRuler"); } return(ruler); }
/// <summary>Retorna o Ruler da sessão</summary> private Ruler getRuler() { User user = Page.User as User; if (user == null) { throw new AlnitakException("User não está autenticado @ ReadyForBattle::getRuler"); } Chronos.Core.Ruler _ruler = Universe.instance.getRuler(user.RulerId); if (_ruler == null) { throw new AlnitakException("Ruler não existe @ ReadyForBattle::getRuler"); } return(_ruler); }
/// <summary>Pinta o Controlo</summary> protected void writeControl(Chronos.Core.Ruler ruler, Chronos.Core.Planet planet) { //MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"]; string control = OrionGlobals.AppPath + "skins/planetaria/controls/ManageBuildings.ascx"; Control planetSkin = Page.LoadControl(control); ResourcesList resources = (ResourcesList)planetSkin.FindControl("resourcesList"); if (resources != null) { resources.Manager = planet; resources.Title = info.getContent("planetResources"); resources.Category = "Intrinsic"; resources.ShowImages = true; resources.ShowDocumentation = false; resources.ResourcesToShow = new string[] { "gold", "mp", "food", "labor", "housing", "energy", "culture", "polution" }; resources.ShowSpace = true; } QueueNotifier queue = (QueueNotifier)planetSkin.FindControl("queue"); if (queue != null) { queue.Manager = planet; queue.Category = "Building"; queue.Title = info.getContent("inProduction"); queue.EmptyMessage = info.getContent("buildingsQueueEmpty"); } PlanetNavigation nav = (PlanetNavigation)planetSkin.FindControl("planetNavigation"); if (null != nav) { nav.Player = ruler; nav.Current = planet; nav.Section = "Buildings"; } writeBuildingList(planet, planetSkin, "general", true); writeBuildingList(planet, planetSkin, "upgrade", false); HyperLink intrinsicHelp = (HyperLink)planetSkin.FindControl("intrinsicHelp"); intrinsicHelp.NavigateUrl = Wiki.GetUrl("Intrinsic", "Intrinsic"); intrinsicHelp.Text = info.getContent("wiki_Intrinsecos"); HyperLink buildingHelp = (HyperLink)planetSkin.FindControl("buildingHelp"); buildingHelp.NavigateUrl = Wiki.GetUrl("Building", "Building"); buildingHelp.Text = info.getContent("wiki_Edificios"); HyperLink queueHelp = (HyperLink)planetSkin.FindControl("queueHelp"); queueHelp.NavigateUrl = Wiki.GetUrl("FilaDeEspera"); queueHelp.Text = info.getContent("wiki_FilaDeEspera"); Controls.Add(planetSkin); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, string.Format("{1} - {0}", info.getContent("section_buildings"), planet.Name)); }