Beispiel #1
0
        protected override void OnPreRender(EventArgs e)
        {
            ruler = getRuler();

            this.Controls.Add( CreateBattles() );

            base.OnPreRender(e);
        }
        protected override void OnPreRender(EventArgs e)
        {
            if( ruler == null )
                ruler = getRuler();

            registerScript();
            base.OnPreRender (e);
        }
 public void OnGameOver(Ruler.GameResult result)
 {
     if (result == Ruler.GameResult.Black_Win)
         GetComponent<UISprite>().spriteName = "black_win";
     else if (result == Ruler.GameResult.White_Win)
         GetComponent<UISprite>().spriteName = "white_win";
     else
         GetComponent<UISprite>().spriteName = "draw";
 }
Beispiel #4
0
        /// <summary>Pinta o Controlo</summary>
        protected override void Render( HtmlTextWriter writer )
        {
            Owner = getRuler();
            for( int i = Owner.Planets.Length - 1; i >= 0 ; --i ) {
                writePlanet(writer, Owner.Planets[i]);
            }

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, info.getContent("section_planets"));
        }
Beispiel #5
0
        private void FillBattle( Ruler ruler, ItemsTable table, string tableTitle, Chronos.Battle.BattleType type )
        {
            table.Title = tableTitle;
            table.TitleCssClass = "planetInfoZoneTitle";
            table.TableCssClass = "planetFrame";

            CreateTitle(table);

            if( ruler == null ) {
                NoBattle( table, 6 );
                return;
            }

            ICollection collection = ruler.GetAllBattles( type );

            if( collection.Count == 0 ) {
                NoBattle( table, 6 );
                return;
            }

            IEnumerator iter = collection.GetEnumerator( );

            while( iter.MoveNext( ) ) {
                ItemsTableLine line = new ItemsTableLine();

                SimpleBattleInfo bInfo = (SimpleBattleInfo)iter.Current;

                ItemsTableText id = new ItemsTableText( bInfo.BattleId.ToString(), "resource" );
                ItemsTableText enemy = new ItemsTableText( OrionGlobals.getLink( bInfo.Enemy ), "resource" );

                ItemsTableLink link = new ItemsTableLink(
                        info.getContent( "battleAdminUser_viewBattle" ),
                        OrionGlobals.calculatePath( string.Format("battle.aspx?id={0}&rulerid={1}",bInfo.BattleId,ruler.Id) ),
                        "resource"
                );

                ItemsTableLinkButton linkButton1 = new ItemsTableLinkButton( bInfo.Owner.Name );
                linkButton1.Click += new EventHandler(linkButton1_Click);

                ItemsTableLinkButton linkButton2 = new ItemsTableLinkButton( bInfo.Enemy.Name );
                linkButton2.Click += new EventHandler(linkButton2_Click);

                ItemsTableImageButton remove = new ItemsTableImageButton( OrionGlobals.getCommonImagePath( "remove.gif" ), "battle_" + bInfo.BattleId );
                remove.Click += new ImageClickEventHandler(remove_Click);

                line.add( id );
                line.add( enemy );
                line.add( link );
                line.add( linkButton1 );
                line.add( linkButton2 );
                line.add( remove );

                table.addLine( line );
            }

            this.Controls.Add( table );
        }
Beispiel #6
0
 private User GetUser( Ruler ruler )
 {
     if( cache.ContainsKey(ruler) ) {
         return (User) cache[ruler];
     }
     User user = UserUtility.bd.getUser(ruler.ForeignId);
     cache[ruler] = user;
     return user;
 }
Beispiel #7
0
        protected override void OnInit(EventArgs e)
        {
            _ruler = getRuler();

            InitTypes();
            CreateUnits();

            base.OnInit( e );
        }
Beispiel #8
0
        protected override void OnLoad(EventArgs e)
        {
            _ruler = getRuler();

            createTable();

            Controls.Add( itemsTable );

            base.OnLoad(e);
        }
Beispiel #9
0
        protected override void OnInit(EventArgs e)
        {
            _ruler = getRuler();

            CreateFleets();

            Controls.Add( _itemsTable );

            base.OnInit( e );
        }
Beispiel #10
0
 public static double EvaluateResult(Ruler.GameResult result, Unit.OwnerEnum owner)
 {
     if (result == Ruler.GameResult.Black_Win)
         return owner == Unit.OwnerEnum.Black ? MaxValue : -MaxValue;
     else if (result == Ruler.GameResult.White_Win)
         return owner == Unit.OwnerEnum.White ? MaxValue : -MaxValue;
     else if (result == Ruler.GameResult.Draw)
         return 0;
     return 0;
 }
Beispiel #11
0
        protected override void OnInit(EventArgs e)
        {
            _ruler = getRuler();

            createTable();

            Controls.Add( _itemsTable );

            OrionGlobals.RegisterRequest(MessageType.Battle, info.getContent("section_military"));

            base.OnInit( e );
        }
Beispiel #12
0
        /// <summary>
        /// carrega todas as informações sobre o Ruler, introduz as informações no repeater
        /// e carrega os contrôlos
        /// </summary>
        protected override void OnInit(EventArgs e)
        {
            ruler = getRuler();

            string name = Page.Request.Form["fleetToRemove"];
            if( name != null && name != string.Empty ) {
                remove( name );
            }

            //regista o codigo de script para esconder/mostrar a fleet
            OrionGlobals.registerShowHideScript( Page );
            base.OnInit (e);
        }
Beispiel #13
0
        /// <summary>Obtm todos os scans de um jogador em todos os planetas</summary>
        public override Scan[] GetScans( Ruler ruler )
        {
            StringWriter writer = new StringWriter();

            writer.Write("SELECT * FROM Scans WHERE SourcePlanetId={0}", ruler.Planets[0].Id);
            for( int i = 1; i < ruler.Planets.Length; ++i ) {
                writer.Write(" or SourcePlanetId={0} ", ruler.Planets[i].Id);
            }
            writer.Write(" ORDER BY Id DESC LIMIT 0, 60");

            DataSet ds = MySqlUtility.getQuery(writer.ToString());
            return DataSetToScans(ds);
        }
Beispiel #14
0
        /// <summary>Obtém todos os scans de um jogador em todos os planetas</summary>
        public override Scan[] GetScans( Ruler ruler )
        {
            StringWriter writer = new StringWriter();

            writer.Write("scans_sourcePlanetId={0}", ruler.Planets[0].Id);
            for( int i = 1; i < ruler.Planets.Length; ++i ) {
                writer.Write(" or scans_sourcePlanetId={0} ", ruler.Planets[i].Id);
            }

            string query = string.Format("SELECT scans_id,scans_data FROM OrionsBelt_Scans WHERE {0} LIMIT {1}", writer.ToString( ),40);
            DataSet ds = PostGreServerUtility.getFromDBWithQuery(query );

            return DataSetToScans(ds);
        }
Beispiel #15
0
        /// <summary>Pinta o controlo</summary>
        protected override void OnLoad(EventArgs e)
        {
            if( planets != null ) {
                ruler = getRuler();

                planets.ItemDataBound += new RepeaterItemEventHandler(planets_ItemDataBound);
                planets.DataSource = ruler.Planets;
                planets.DataBind();
            }

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, info.getContent("section_planets"));

            base.OnLoad (e);
        }
Beispiel #16
0
        protected override void OnInit(EventArgs e)
        {
            _ruler = getRuler();
            CreateUnits();

            if( !itemsTable.HasControls() ) {
                Visible = false;
            }else {
                Visible = true;
                Controls.Add(itemsTable);
            }

            base.OnInit (e);
        }
        private bool CanCreateBattle(Ruler r)
        {
            if( r.InVacation ) {
                return false;
            }

            if( r.Premium ) {
                return true;
            }

            int battleCount = r.GetAllBattles(BattleType.FRIENDLY).Count;
            int battleLimit = int.Parse(OrionGlobals.getConfigurationValue("alnitak","friendlyLimit"));

            return battleCount < battleLimit;
        }
        /// <summary>Obtém todos os scans de um jogador em todos os planetas</summary>
        public override Scan[] GetScans( Ruler ruler )
        {
            StringWriter writer = new StringWriter();

            writer.Write("scans_sourcePlanetId={0}", ruler.Planets[0].Id);
            for( int i = 1; i < ruler.Planets.Length; ++i ) {
                writer.Write(" or scans_sourcePlanetId={0} ", ruler.Planets[i].Id);
            }

            Hashtable parameters = new Hashtable();
            parameters.Add("@count", 40 );
            parameters.Add("@types", writer.ToString( ) );

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_GetScans", parameters );

            return DataSetToScans(ds);
        }
Beispiel #19
0
 /// <summary>Inicializa o controlo de construco de pesquisas</summary>
 private void initResearchList( Ruler ruler, Control control, QueueErrorReport queueError, string cat )
 {
     Resources resources = (Resources) control.FindControl(cat);
     if( resources == null ) {
         return;
     }
     resources.Manager = ruler;
     resources.Cost = null;
     resources.ShowDemolish = false;
     resources.ShowQuantity = false;
     resources.QueueError = queueError;
     resources.Title = string.Format("<b>{0}</b> - {1}", info.getContent(cat), info.getContent("researchTitle"));
     resources.Category = "Research";
     resources.ShowDocumentation = true;
     resources.ShowDuration = true;
     resources.CategoryDescription = cat;
 }
Beispiel #20
0
        protected override void OnInit(EventArgs e)
        {
            _ruler = getRuler();
            _maximumAvailableControl = getTravelControlId();

            _startCoordinate = _ruler.HomePlanet.Coordinate;
            if( _startCoordinate == null ) {
                throw new Exception("Ruler HomePlanet Coordinate == null");
            }

            if( _maximumAvailableControl == 0 ) {
                return;
            }

            HttpContext.Current.Session["MaximumAvailableControl"] = _maximumAvailableControl;

            base.OnInit (e);
        }
        protected override void OnInit(EventArgs e)
        {
            OrionGlobals.RegisterRequest(MessageType.Battle, info.getContent("section_battle"));
            _ruler = getRuler();

            if( CanCreateBattle(_ruler) ) {
                chooseRuler.Visible = true;
                createBattle.ImageUrl = OrionGlobals.getCommonImagePath( "ok.gif" );

                PopulateRulers();
                PopulateBattleTypes();

                shipSelector.FleetCreated += new EventHandler( createBattle_Click );
            }else {
                chooseRuler.Visible = false;
                Information.AddInformation(string.Format(info.getContent("battle_cannotCreatefriendlys"),int.Parse(OrionGlobals.getConfigurationValue("alnitak","friendlyLimit"))));
            }

            base.OnInit( e );
        }
 private void Ruler_ScrollToRequested_1(object sender, ScrollToRequestEventArgs e)
 {
     Ruler.ScrollTo(e.Index);
 }
Beispiel #23
0
        /// <summary>Evento de click no butão</summary>
        protected void onUpdateClick(object src, EventArgs args)
        {
            Console.WriteLine("Update click");
            if (!Page.IsValid)
            {
                Trace.Write("ProfileControl", "Fields not valid");
                Console.WriteLine("Profile fields not valid");
                return;
            }
            Console.WriteLine("Profile fields valid");
            Trace.Write("ProfileControl", "Login fields valid");

            userUpdated.Visible = true;
            User user = (User)Page.User;

            user.Nick      = nick.Text;
            user.Avatar    = avatar.Text;
            user.Website   = website.Text;
            user.Lang      = lang.SelectedValue;
            user.Skin      = int.Parse(skin.SelectedValue);
            user.ImagesDir = imagesDir.Text;

            user.Msn    = msn.Text;
            user.Icq    = icq.Text;
            user.Jabber = jabber.Text;
            user.Aim    = aim.Text;
            user.Yahoo  = yahoo.Text;

            user.Signature = signature.Text;

            if (vacation.Enabled)
            {
                Ruler ruler = Universe.instance.getRuler(user.RulerId);
                if (vacation.Checked)
                {
                    ruler.StartVacations();
                }
                else
                {
                    int forcedTime = 300;
#if DEBUG
                    forcedTime = 0;
#endif
                    if (ruler.InVacation && ruler.VacationTurns < forcedTime && !user.IsInRole("admin") && !user.IsInRole("betaTester"))
                    {
                        Information.AddInformation(string.Format(info.getContent("profile_vacation_error"), ruler.VacationTurns, forcedTime));
                        vacation.Checked = true;
                        return;
                    }
                    else
                    {
                        ruler.EndVacations();
                    }
                }
            }

            if (user.RulerId != -1)
            {
                Ruler ruler = Universe.instance.getRuler(user.RulerId);
                ruler.Name = user.Nick;
            }

            System.Web.HttpContext.Current.Cache.Remove(OrionGlobals.ForumSkinName);

            UserUtility.bd.saveUser(user, password.Text);
            Response.Redirect(OrionGlobals.calculatePath("default.aspx"));
        }
Beispiel #24
0
 /// <summary>Traduz um Ruler para texto localizado</summary>
 public string translate(Ruler ruler)
 {
     return(OrionGlobals.getLink(ruler));
 }
Beispiel #25
0
 internal LayerItemManager(Ruler parent)
 {
     _Container = parent;
     //Layers.Add(new LayerItem() { Name = "Default" });
 }
Beispiel #26
0
        public KeyBoardInteractionDiagramVM()
        {
            #region Properties

            Constraints = Constraints.Add(GraphConstraints.Undoable);

            DefaultConnectorType = ConnectorType.Line;

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();
            VerticalRuler   = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };



            Theme            = new LinearTheme();
            Theme.NodeStyles = (Theme as LinearTheme).VariantStyles[1];

            #endregion

            #region Nodes and Connectors Creation

            CustomNode Node1  = CreateNode(550, 100, "A", "SkyBlue", "1", "");
            CustomNode Node2  = CreateNode(450, 200, "B", "Red", "2", "1");
            CustomNode Node3  = CreateNode(550, 200, "C", "Red", "3", "1");
            CustomNode Node4  = CreateNode(650, 200, "D", "Red", "4", "1");
            CustomNode Node5  = CreateNode(400, 300, "E", "Yellow", "5", "2");
            CustomNode Node6  = CreateNode(500, 300, "F", "Yellow", "6", "2");
            CustomNode Node7  = CreateNode(600, 300, "G", "Yellow", "7", "4");
            CustomNode Node8  = CreateNode(700, 300, "H", "Yellow", "8", "4");
            CustomNode Node9  = CreateNode(450, 400, "I", "Violet", "9", "6");
            CustomNode Node10 = CreateNode(550, 400, "J", "Violet", "10", "6");
            CustomNode Node11 = CreateNode(650, 400, "K", "Violet", "11", "8");
            CustomNode Node12 = CreateNode(750, 400, "L", "Violet", "12", "8");
            CustomNode Node13 = CreateNode(400, 500, "M", "Green", "13", "9");
            CustomNode Node14 = CreateNode(500, 500, "N", "Green", "14", "9");
            CustomNode Node15 = CreateNode(600, 500, "O", "Green", "15", "11");
            CustomNode Node16 = CreateNode(700, 500, "P", "Green", "16", "11");
            CustomNode Node17 = CreateNode(450, 600, "Q", "SkyBlue", "17", "14");
            CustomNode Node18 = CreateNode(550, 600, "R", "SkyBlue", "18", "14");
            CustomNode Node19 = CreateNode(650, 600, "S", "SkyBlue", "19", "16");
            CustomNode Node20 = CreateNode(750, 600, "T", "SkyBlue", "20", "16");

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);
            (Nodes as NodeCollection).Add(Node3);
            (Nodes as NodeCollection).Add(Node4);
            (Nodes as NodeCollection).Add(Node5);
            (Nodes as NodeCollection).Add(Node6);
            (Nodes as NodeCollection).Add(Node7);
            (Nodes as NodeCollection).Add(Node8);
            (Nodes as NodeCollection).Add(Node9);
            (Nodes as NodeCollection).Add(Node10);
            (Nodes as NodeCollection).Add(Node11);
            (Nodes as NodeCollection).Add(Node12);
            (Nodes as NodeCollection).Add(Node13);
            (Nodes as NodeCollection).Add(Node14);
            (Nodes as NodeCollection).Add(Node15);
            (Nodes as NodeCollection).Add(Node16);
            (Nodes as NodeCollection).Add(Node17);
            (Nodes as NodeCollection).Add(Node18);
            (Nodes as NodeCollection).Add(Node19);
            (Nodes as NodeCollection).Add(Node20);

            CreateConnector(Node1, Node2);
            CreateConnector(Node1, Node3);
            CreateConnector(Node1, Node4);
            CreateConnector(Node2, Node5);
            CreateConnector(Node2, Node6);
            CreateConnector(Node4, Node7);
            CreateConnector(Node4, Node8);
            CreateConnector(Node6, Node9);
            CreateConnector(Node6, Node10);
            CreateConnector(Node8, Node11);
            CreateConnector(Node8, Node12);
            CreateConnector(Node9, Node13);
            CreateConnector(Node9, Node14);
            CreateConnector(Node11, Node15);
            CreateConnector(Node11, Node16);
            CreateConnector(Node14, Node17);
            CreateConnector(Node14, Node18);
            CreateConnector(Node16, Node19);
            CreateConnector(Node16, Node20);

            #endregion

            #region Commands and CommandManager

            // Custom command and Modified Commands

            CustomGroup   = new Command(OnCustomGroupCommand);
            CustomUngroup = new Command(OnCustomUngroupCommand);
            ChildNode     = new Command(OnChildNodeCommand);
            ParentNode    = new Command(OnParentNodeCommand);
            NextChild     = new Command(OnNextChildCommand);
            PreviousChild = new Command(OnPreviousChildCommand);

            ItemAddedCommand = new Command(OnItemAdded);

            CommandManager = new Syncfusion.UI.Xaml.Diagram.CommandManager();

            (CommandManager as Syncfusion.UI.Xaml.Diagram.CommandManager).Commands = new CommandCollection();

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "CustomGroup",
                Command = CustomGroup,
                Gesture = new Gesture
                {
                    KeyModifiers = ModifierKeys.Control,
                    KeyState     = KeyStates.Down,
                    Key          = System.Windows.Input.Key.G,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "CustomUngroup",
                Command = CustomUngroup,
                Gesture = new Gesture
                {
                    KeyModifiers = ModifierKeys.Control,
                    KeyState     = KeyStates.Down,
                    Key          = System.Windows.Input.Key.U,
                },
            }
            );


            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "ChildNode",
                Command = ChildNode,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Down,
                },
            }
            );


            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "ParentNode",
                Command = ParentNode,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Up,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "NextChild",
                Command = NextChild,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Right,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "PreviousChild",
                Command = PreviousChild,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Left,
                },
            }
            );

            #endregion
        }
Beispiel #27
0
 public void PlayerSendCard(Player player, ICollection <CardGroup> cardGroups)
 {
     if (Ruler.IsValidateForPlayer(player.Cards.ToCardGroups(), cardGroups) && Ruler.IsValidate(this, cardGroups))
     {
         var cards = cardGroups.ToCards();
         player.RemoveCard(cards);
         LastSendIndex = Cycle.List.FindIndex(p => p == player);
         var stringBuilder = new StringBuilder();
         cards.ForEach(card => stringBuilder.Append(card));
         GroupSender.Send($"{player.ToAtCode()} 出牌: {stringBuilder}");
         Cycle.MoveNext();
         Tick();
     }
     else
     {
         GroupSender.Send("你出的牌无效");
     }
 }
Beispiel #28
0
 public MapControl()
 {
     InitializeComponent();
     _ruler = new Ruler();
 }
Beispiel #29
0
 /// <summary>Obtm todos os scans de um jogador em todos os planetas</summary>
 public abstract Scan[] GetScans( Ruler ruler );
Beispiel #30
0
 /// <summary>Retorna um link completo para um ruler</summary>
 public static string getLink(Ruler ruler)
 {
     return(getLink(ruler, AppPath));
 }
Beispiel #31
0
 /// <summary>Retorna um link completo para um ruler</summary>
 public static string getCompleteLink(Ruler ruler)
 {
     return(getLink(ruler, AlnitakUrl));
 }
Beispiel #32
0
        private void RenderRulers(HtmlTextWriter writer, int start, int count, Ruler current, string onlineImage, string offlineImage, bool pod)
        {
            writer.WriteLine("<table class='planetFrame'>");
            writer.WriteLine("<tr class='resourceTitle'>");
            writer.WriteLine("<td class='resourceTitle'>#</td>");

            if (pod)
            {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("profile_avatarText"));
            }

            writer.WriteLine("<td class='resourceTitle'>Ruler</td>");

            if (ShowOnline)
            {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("online"));
            }
            if (ShowPlanets)
            {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("planetas"));
            }

            if (ShowBattles)
            {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("batalhas"));
            }

            if (ShowRank)
            {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("battle_rank"));
            }

            if (ShowScore)
            {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("score"));
            }

            writer.WriteLine("</tr>");

            for (int i = start; i < count; ++i)
            {
                Ruler ruler = Universe.instance.Rank[i];

                writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                writer.WriteLine("<td class='resourceCell'>{0}&ordm;</td>", ruler.Rank);

                if (pod)
                {
                    writer.WriteLine("<td class='resourceCell'><img class='avatar' src='{0}'/></td>", UserUtility.bd.getAvatar(ruler.Id));
                }

                bool rulerViewing = (current != null && current.Id == ruler.Id);

                writer.WriteLine("<td class='resource'>");

                // mostrar a imagem de estado de ranking
                if (ruler.Rank == ruler.LastRank || ruler.LastRank == -1)
                {
                    writer.WriteLine("<img src='{0}' /> ", OrionGlobals.getCommonImagePath("equal.gif"));
                }
                else
                {
                    if (ruler.Rank > ruler.LastRank)
                    {
                        writer.WriteLine("<img src='{0}' /> ", OrionGlobals.getCommonImagePath("down.gif"));
                    }
                    else
                    {
                        writer.WriteLine("<img src='{0}' /> ", OrionGlobals.getCommonImagePath("up.gif"));
                    }
                }

                // mostrar o nome do ruler
                if (rulerViewing)
                {
                    writer.WriteLine("<b>{0}</b>", OrionGlobals.getLink(ruler));
                }
                else
                {
                    writer.WriteLine(OrionGlobals.getLink(ruler));
                }

                writer.WriteLine("</td>");

                // indicar se o utilizador está online
                if (ShowOnline)
                {
                    if (OrionGlobals.isUserOnline(ruler.ForeignId))
                    {
                        writer.WriteLine("<td class='resourceCell'><img src='{0}' /></td>", onlineImage);
                    }
                    else
                    {
                        writer.WriteLine("<td class='resourceCell'><img src='{0}' /></td>", offlineImage);
                    }
                }

                if (ShowPlanets)
                {
                    writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Planets.Length);
                }

                if (ShowOnline)
                {
                    writer.WriteLine("<td class='resourceCell'><span class='green'>{0}</span>/<span class='orange'>{1}</span>/<span class='red'>{2}</span></td>", ruler.Victories, ruler.Draws, ruler.Defeats);
                }

                if (ShowRank)
                {
                    writer.WriteLine("<td class='resourceCell'>{0}</td>", info.getContent(ruler.Ranking));
                }

                if (ShowScore)
                {
                    writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.format(ruler.getResourceCount("score")));
                }

                writer.WriteLine("</tr>");
            }
            writer.WriteLine("</table>");
        }
Beispiel #33
0
        public CommandsViewModel()
        {
            Constraints = GraphConstraints.Default | GraphConstraints.Undoable;

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands,
            };

            ItemSelectedCommand   = new DelegateCommand(OnItemSelectedCommand);
            ItemUnSelectedCommand = new DelegateCommand(OnItemUnSelectedCommand);

            AllCommand = new DelegateCommand(OnAllCommandExecution);

            CreateNode(40, 60, 150, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 150, 170, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 100, 150, 240, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(60, 40, 80, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(80, 40, 160, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(100, 40, 240, 470, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(40, 80, 600, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 750, 100, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 80, 720, 180, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CreateNode(40, 80, 600, 400, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 600, 500, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(40, 80, 750, 430, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            CommandsCustomNodeViewModel node = new CommandsCustomNodeViewModel
            {
                UnitHeight  = 100,
                UnitWidth   = 100,
                OffsetX     = 1100,
                OffsetY     = 120,
                FillColor   = (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")),
                Shape       = resourceDictionary["RightTriangle"],
                Annotations = null,
                Key         = "Flip",
            };

            CreateNode(20, 60, 1100, 350, (SolidColorBrush)(new BrushConverter().ConvertFrom("#DAEBFF")), "");
            CreateNode(40, 80, 1100, 420, (SolidColorBrush)(new BrushConverter().ConvertFrom("#F5E0F7")), "");
            CreateNode(50, 100, 1100, 500, (SolidColorBrush)(new BrushConverter().ConvertFrom("#E0E5BB")), "");

            (Nodes as NodeCollection).Add(node);

            CreateNode(20, 200, 150, 40, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(50, 250, 150, 300, new SolidColorBrush(Colors.Transparent), "Try Alignment Commands(AlignLeft, AlignRight and AlignCenter)");
            CreateNode(20, 200, 150, 370, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(50, 250, 170, 580, new SolidColorBrush(Colors.Transparent), "Try Alignment Commands(AlignTop, AlignBottom and AlignMiddle)");
            CreateNode(20, 200, 700, 40, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(20, 250, 700, 240, new SolidColorBrush(Colors.Transparent), "Try SpaceAcross Command");
            CreateNode(20, 200, 700, 320, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(20, 250, 700, 570, new SolidColorBrush(Colors.Transparent), "Try SpaceDown Command");
            CreateNode(20, 200, 1100, 40, new SolidColorBrush(Colors.Transparent), "Select the below node");
            CreateNode(20, 250, 1100, 240, new SolidColorBrush(Colors.Transparent), "Try Flip Commands");
            CreateNode(20, 200, 1100, 300, new SolidColorBrush(Colors.Transparent), "Select the below nodes");
            CreateNode(20, 250, 1100, 570, new SolidColorBrush(Colors.Transparent), "Try Sizing Commands");
        }
Beispiel #34
0
 public void loadResources()
 {
     ruler = new Ruler();
 }
Beispiel #35
0
        public RulerPtr Assign(Ruler rhs)
        {
            RulerPtr ret = new RulerPtr(Interop.Ruler.RulerPtr_Assign__SWIG_1(swigCPtr, Ruler.getCPtr(rhs)), false);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #36
0
 public override void ConfigureStep(EcoBlock ecoblock)
 {
     Ruler ruler = (Ruler)ecoblock;
 }
Beispiel #37
0
 public override void CycleStep(EcoBlock ecoblock)
 {
     Ruler ruler = (Ruler)ecoblock;
 }
Beispiel #38
0
        /// <summary>Mostra os recursos</summary>
        private void WriteShips( Ruler ruler, HtmlTextWriter writer, string[] categories )
        {
            writer.WriteLine("<div class='planetInfoZoneTitle'>{0}</div>", CultureModule.getContent("Unit"));
            writer.WriteLine("<table class='planetFrame'>");
            WriteTitle(writer, categories);

            Hashtable counter = new Hashtable();
            foreach( Planet planet in ruler.Planets ) {
                WritePlanetShips(planet, writer, counter, categories);
            }

            WriteTotal(writer, Ships.Keys, counter, true);

            writer.WriteLine("</table>");
        }
Beispiel #39
0
        public MeasureUnits GetRulersUnit()
        {
            Ruler tmpRuler = (Ruler)topRuler;

            return(tmpRuler.MeasureUnit);
        }
Beispiel #40
0
        private void RenderRulers( HtmlTextWriter writer, int start, int count, Ruler current, string onlineImage, string offlineImage, bool pod )
        {
            writer.WriteLine("<table class='planetFrame'>");
            writer.WriteLine("<tr class='resourceTitle'>");
            writer.WriteLine("<td class='resourceTitle'>#</td>");

            if( pod ) {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("profile_avatarText"));
            }

            writer.WriteLine("<td class='resourceTitle'>Ruler</td>");

            if( ShowOnline ) {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("online"));
            }
            if( ShowPlanets) {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("planetas"));
            }

            if( ShowBattles ) {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("batalhas"));
            }

            if( ShowRank ) {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("battle_rank"));
            }

            if( ShowScore ) {
                writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("score"));
            }

            writer.WriteLine("</tr>");

            for( int i = start; i < count; ++i ) {
                Ruler ruler = Universe.instance.Rank[i];

                writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                writer.WriteLine("<td class='resourceCell'>{0}&ordm;</td>", ruler.Rank );

                if( pod ) {
                    writer.WriteLine("<td class='resourceCell'><img class='avatar' src='{0}'/></td>", UserUtility.bd.getAvatar( ruler.Id ) );
                }

                bool rulerViewing = (current != null && current.Id == ruler.Id);

                writer.WriteLine("<td class='resource'>");

                // mostrar a imagem de estado de ranking
                if( ruler.Rank == ruler.LastRank || ruler.LastRank == -1 ) {
                    writer.WriteLine("<img src='{0}' /> ",OrionGlobals.getCommonImagePath("equal.gif"));
                } else {
                    if( ruler.Rank > ruler.LastRank ) {
                        writer.WriteLine("<img src='{0}' /> ",OrionGlobals.getCommonImagePath("down.gif"));
                    } else {
                        writer.WriteLine("<img src='{0}' /> ",OrionGlobals.getCommonImagePath("up.gif"));
                    }
                }

                // mostrar o nome do ruler
                if( rulerViewing ) {
                    writer.WriteLine("<b>{0}</b>", OrionGlobals.getLink(ruler));
                } else {
                    writer.WriteLine(OrionGlobals.getLink(ruler));
                }

                writer.WriteLine("</td>");

                // indicar se o utilizador está online
                if( ShowOnline ) {
                    if( OrionGlobals.isUserOnline(ruler.ForeignId) ) {
                        writer.WriteLine("<td class='resourceCell'><img src='{0}' /></td>", onlineImage);
                    } else {
                        writer.WriteLine("<td class='resourceCell'><img src='{0}' /></td>", offlineImage);
                    }
                }

                if( ShowPlanets ) {
                    writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Planets.Length );
                }

                if( ShowOnline ) {
                    writer.WriteLine("<td class='resourceCell'><span class='green'>{0}</span>/<span class='orange'>{1}</span>/<span class='red'>{2}</span></td>", ruler.Victories, ruler.Draws, ruler.Defeats );
                }

                if( ShowRank ) {
                    writer.WriteLine("<td class='resourceCell'>{0}</td>", info.getContent(ruler.Ranking) );
                }

                if( ShowScore ) {
                    writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.format(ruler.getResourceCount("score")) );
                }

                writer.WriteLine("</tr>");
            }
            writer.WriteLine("</table>");
        }
Beispiel #41
0
 internal GuideLineManager(Ruler parent)
 {
     _Container = parent;
 }
Beispiel #42
0
        public PortsDiagramViewModel()
        {
            #region DiagramViewModel Properties , Commands Initialization

            ItemUnSelectedCommand = new Command(OnItemUnselectedCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            Theme = new SimpleTheme();

            DefaultConnectorType = ConnectorType.Orthogonal;

            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands | SelectorConstraints.HideDisabledResizer,
            };

            #endregion

            #region Node Creation

            NodeViewModel Node1 = CreateNode(65, 100, 200, 150, "Rectangle", "Publisher", true);
            NodeViewModel Node2 = CreateNode(65, 100, 450, 150, "Rectangle", "Completed Book", false);
            NodeViewModel Node3 = CreateNode(65, 100, 700, 150, "Rectangle", "Board", false);
            NodeViewModel Node4 = CreateNode(65, 100, 450, 300, "Decision", "1st Review", false);
            NodeViewModel Node5 = CreateNode(65, 100, 700, 300, "Decision", "Approval", false);
            NodeViewModel Node6 = CreateNode(65, 100, 450, 450, "Rectangle", "Legal Terms", false);
            NodeViewModel Node7 = CreateNode(65, 100, 450, 600, "Decision", "2nd Review", false);

            #endregion

            #region Port Creation

            CreateNodePort(Node1, "NodePort11", 0, 0.5, "In");
            CreateNodePort(Node1, "NodePort12", 1, 0.5, "Out");
            CreateNodePort(Node1, "NodePort13", 0.25, 1, "In");
            CreateNodePort(Node1, "NodePort14", 0.5, 1, "Out");
            CreateNodePort(Node1, "NodePort15", 0.75, 1, "In");

            CreateNodePort(Node2, "NodePort21", 0, 0.5, "In");
            CreateNodePort(Node2, "NodePort22", 0.5, 1, "Out");
            CreateNodePort(Node2, "NodePort23", 1, 0.4, "Out");
            CreateNodePort(Node2, "NodePort24", 1, 0.6, "In");

            CreateNodePort(Node3, "NodePort31", 0, 0.4, "In");
            CreateNodePort(Node3, "NodePort32", 0.5, 1, "Out");

            CreateNodePort(Node4, "NodePort41", 0, 0.5, "Out");
            CreateNodePort(Node4, "NodePort42", 0.5, 0, "In");
            CreateNodePort(Node4, "NodePort43", 0.5, 1, "Out");

            CreateNodePort(Node5, "NodePort51", 0.5, 0, "In");
            CreateNodePort(Node5, "NodePort52", 0.5, 1, "Out");

            CreateNodePort(Node6, "NodePort61", 0, 0.5, "In");
            CreateNodePort(Node6, "NodePort62", 0.5, 0, "In");
            CreateNodePort(Node6, "NodePort63", 0.5, 1, "Out");

            CreateNodePort(Node7, "NodePort71", 0, 0.5, "Out");
            CreateNodePort(Node7, "NodePort72", 0.5, 0, "In");
            CreateNodePort(Node7, "NodePort73", 1, 0.5, "Out");

            #endregion

            #region NodeCollection

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);
            (Nodes as NodeCollection).Add(Node3);
            (Nodes as NodeCollection).Add(Node4);
            (Nodes as NodeCollection).Add(Node5);
            (Nodes as NodeCollection).Add(Node6);
            (Nodes as NodeCollection).Add(Node7);

            #endregion
        }
Beispiel #43
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Ruler obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #44
0
        public CameraController(RenderingLibrary.Camera camera, SystemManagers managers, Cursor cursor, Keyboard keyboard, GraphicsDeviceControl control, Ruler topRuler, Ruler leftRuler)
        {
            this.TopRuler  = topRuler;
            this.LeftRuler = leftRuler;
            Cursor         = cursor;
            Camera         = camera;
            Managers       = managers;

            cameraPanningLogic = new CameraPanningLogic(control, managers, cursor, keyboard);
        }
Beispiel #45
0
        private void CreateFleets()
        {
            Hashtable universeFleets = _ruler.UniverseFleets;

            _itemsTable.Title         = info.getContent("battle_fleetsReadyToBattle");
            _itemsTable.TitleCssClass = "planetInfoZoneTitle";
            _itemsTable.TableCssClass = "planetFrame";

            createTitle(_itemsTable);
            bool isOneReady = false;

            if (universeFleets != null && universeFleets.Count > 0)
            {
                IDictionaryEnumerator iter = universeFleets.GetEnumerator();

                while (iter.MoveNext())
                {
                    Chronos.Core.Fleet f = (Chronos.Core.Fleet)iter.Value;
                    Planet             p = Universe.instance.getPlanet(f.Coordinate);

                    if (f.GoodForBattle)
                    {
                        ItemsTableLine line = new ItemsTableLine();

                        ItemsTableText fleet = new ItemsTableText(f.Name, "resource");
                        ItemsTableText coord = new ItemsTableText(f.Coordinate.ToString(), "resource");

                        ItemsTableText rulerName;
                        if (p.Owner != null)
                        {
                            rulerName = new ItemsTableText(OrionGlobals.getLink((Ruler)p.Owner), "resource");
                        }
                        else
                        {
                            rulerName = new ItemsTableText(info.getContent("conquerplanet_none"), "resource");
                        }

                        ItemsTableItem action;

                        if (p.IsInBattle)
                        {
                            action = new ItemsTableText(info.getContent("battle_isInBattle"), "resource");
                        }
                        else
                        {
                            if (p.HasImmunity)
                            {
                                action = new ItemsTableText(string.Format(info.getContent("BattleImmunity"), p.Immunity), "resource");
                            }
                            else
                            {
                                if (p.Owner != null && Ruler.IsSameAlliance((Ruler)p.Owner, (Ruler)f.Owner))
                                {
                                    action = new ItemsTableText(info.getContent("battle_sameAlliance"), "resource");
                                }
                                else
                                {
                                    if (!p.HasProtection)
                                    {
                                        action = new ItemsTableText(info.getContent("planet_not_protected"), "resource");
                                    }
                                    else
                                    {
                                        action = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("ok.gif"), fleet.ID);
                                        ((ItemsTableImageButton)action).Click += new ImageClickEventHandler(submit_Click);
                                    }
                                }
                            }
                        }

                        line.add(fleet);
                        line.add(coord);
                        line.add(rulerName);
                        line.add(action);

                        _itemsTable.addLine(line);

                        isOneReady = true;
                    }
                }
            }

            if (!isOneReady)
            {
                insertNoFleets();
            }
        }
    // Specific TileMap names, called from TileMapBuilder, are manually created here


    public void BuildRuleMap(TileMap givenMap)
    {
        Location loc        = LocationController.Instance.GetSelectedLocation();
        Ruler    localRuler = loc.localRuler;

        for (int x = 0; x < givenMap.xSize; x += 1)
        {
            for (int y = 0; y < givenMap.ySize; y += 1)
            {
                givenMap.GetTileAt(x, y).SetTileEcoBlockType(EcoBlock.BlockType.Unassigned);
            }
        }

        int xPos = 5;
        int yPos = 0;

        Territory terr = TerritoryController.Instance.GetTerritoryAtLocation(loc);

        if (terr != null)
        {
            givenMap.GetTileAt(xPos, yPos).SetTileEcoBlockType(EcoBlock.BlockType.Territory);
            givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(terr);
        }

        foreach (Population pop in PopulationController.Instance.GetPopulationsAtLocation(loc))
        {
            if (pop != null)
            {
                xPos += 2;
                givenMap.GetTileAt(xPos, yPos).SetTileEcoBlockType(EcoBlock.BlockType.Population);
                givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(pop);
            }
        }
        xPos = 5;
        yPos = 2;
        givenMap.GetTileAt(xPos, yPos).SetLinkedLocation(loc);
        xPos = 5;
        yPos = 4;


        // Add secondary rulers
        foreach (Ruler ruler in RulerController.Instance.GetLocationRulers(loc))
        {
            if (ruler != null && ruler.isLocalRuler == false)
            {
                xPos += 2;
                givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(ruler);
            }
        }

        // Add local ruler
        if (localRuler != null)
        {
            if (localRuler.rulerHierarchy == Ruler.Hierarchy.Dominating)
            {
                xPos = 5;
                yPos = 6;
                givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(localRuler);
                foreach (Location contloc in localRuler.GetControlledLocations())
                {
                    xPos += 2;
                    givenMap.GetTileAt(xPos, yPos).SetLinkedLocation(contloc);
                }
            }
            else if (localRuler.rulerHierarchy == Ruler.Hierarchy.Independent)
            {
                xPos = 5;
                yPos = 4;
                givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(localRuler);
            }

            else if (localRuler.rulerHierarchy == Ruler.Hierarchy.Dominated)
            {
                xPos = 5;
                yPos = 4;
                givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(localRuler);
                yPos = 6;
                givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(localRuler.GetController());
                xPos += 2;
                givenMap.GetTileAt(xPos, yPos).SetLinkedLocation(localRuler.GetController().GetHomeLocation());
                foreach (Location contloc in localRuler.GetController().GetControlledLocations())
                {
                    xPos += 2;
                    givenMap.GetTileAt(xPos, yPos).SetLinkedLocation(contloc);
                }
            }
        }
        else if (loc.dominatingRuler != null)
        {
            xPos = 5;
            yPos = 6;
            givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(loc.dominatingRuler);
            xPos += 2;
            givenMap.GetTileAt(xPos, yPos).SetLinkedLocation(loc.dominatingRuler.GetHomeLocation());
            foreach (Location contloc in loc.dominatingRuler.GetControlledLocations())
            {
                xPos += 2;
                givenMap.GetTileAt(xPos, yPos).SetLinkedLocation(contloc);
            }
        }

        xPos = 5;
        yPos = 2;


        foreach (Warband warband in WarbandController.Instance.GetWarbandsAtLocation(loc))
        {
            if (warband != null)
            {
                xPos -= 2;
                givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(warband);
            }
        }
        xPos = 5;
        yPos = 4;
        if (localRuler != null)
        {
            foreach (Warband warband in localRuler.GetControlledWarbands())
            {
                if (warband != null)
                {
                    xPos -= 2;
                    givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(warband);
                }
            }
            xPos = 5;
            yPos = 6;
            if (localRuler.rulerHierarchy == Ruler.Hierarchy.Dominated)
            {
                foreach (Warband warband in localRuler.GetController().GetControlledWarbands())
                {
                    if (warband != null)
                    {
                        xPos -= 2;
                        givenMap.GetTileAt(xPos, yPos).SetLinkedEcoBlock(warband);
                    }
                }
            }
        }
    }
Beispiel #47
0
        private void InitQueryStrings( )
        {
            string id = HttpContext.Current.Request.QueryString["id"];

            if( id == null && id == string.Empty && OrionGlobals.isInt( id ) ) {
                Redirect();
            }

            string rulerid = HttpContext.Current.Request.QueryString["rulerid"];
            if( null == rulerid ) {
                _ruler = GetRuler();
            }else {
                if( rulerid == null && rulerid == string.Empty && OrionGlobals.isInt( rulerid ) ) {
                    Redirect();
                }
                _ruler = Universe.instance.getRuler( int.Parse( rulerid ) );
                _adminView = true;
            }
        }
Beispiel #48
0
        /// <summary>Mostra a documentação</summary>
        private void showInfo(HtmlTextWriter writer, User user)
        {
            showUserRole(writer, user);

            writer.WriteLine("<div class='planetInfoZoneTitle'>{0} - <b>{1}</b></div>",
                             info.getContent("information"), user.Nick
                             );

            string avatar = user.Avatar != string.Empty?user.Avatar:Alnitak.User.DefaultAvatar;

            writer.WriteLine("<table cellpadding='0' cellspacing='0' class='planetFrame' >");
            writer.WriteLine("<tr><td>");
            writer.WriteLine("<table width='100%'>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource' width='50%'>{0}</td>", info.getContent("name"));
            writer.WriteLine("<td class='resourceCell' width='50%'>{0}</td>", OrionGlobals.getLink(user));
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("online"));
            writer.WriteLine("<td class='resourceCell'>");
            if (OrionGlobals.isUserOnline(user.UserId))
            {
                writer.WriteLine("<img src='{0}' />", OrionGlobals.getCommonImagePath("online.gif"));
            }
            else
            {
                writer.WriteLine("<img src='{0}' />", OrionGlobals.getCommonImagePath("offline.gif"));
            }
            writer.WriteLine("</td>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("profile_website"));
            writer.WriteLine("<td class='resourceCell'><a href='{0}'>{0}</a></td>", user.Website == string.Empty?"-":user.Website);
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("section_contact"));
            writer.WriteLine("<td class='resourceCell'><a href='{0}forum/default.aspx?g=pmessage&u={1}'>{2}</a></td>", OrionGlobals.AppPath, user.UserId, info.getContent("pmsg_send"));
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("profile_signature"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", user.Signature == string.Empty?"-":user.Signature);
            writer.WriteLine("</tr>");
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("profile_regist"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.FormatDateTime(user.RegistDate));
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("profile_lastLogin"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", OrionGlobals.FormatDateTime(user.LastLogin));
            writer.WriteLine("</tr>");
            writer.WriteLine("</tr>");

            writer.WriteLine("</table>");

            writer.WriteLine("</td>");

            writer.WriteLine("<td class='resource' align='center'><fieldset><legend><b>{1}</b></legend><img class='avatar' src='{0}'/></fieldset></td></tr>", avatar, info.getContent("profile_avatarText"));

            writer.WriteLine("</table>");

            writer.WriteLine("<div class='planetInfoZoneTitle'>{0} - <b>{1}</b></div>",
                             info.getContent("elo_battle_rank"), user.Nick
                             );

            writer.WriteLine("<table class='planetFrame'>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("score"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", user.EloRanking);
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("elo_battle_rank"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", user.EloRankDescription);
            writer.WriteLine("</tr>");

            User current = Context.User as User;

            if (current != null)
            {
                Ranking[] ranks       = GetMatchResult(current, user, BattleResult.NumberOneVictory);
                int       ifWinPoints = ranks[0].EloRanking - current.EloRanking;
                writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("IfWin"));
                writer.WriteLine("<td class='resourceCell'>{0} (<span class='green'>+{1}</span>)</td>", ranks[0].EloRanking, ifWinPoints);
                writer.WriteLine("</tr>");

                ranks = GetMatchResult(current, user, BattleResult.NumberTwoVictory);
                int ifLoosePoints = ranks[0].EloRanking - current.EloRanking;
                writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("IfLoose"));
                writer.WriteLine("<td class='resourceCell'>{0} (<span class='red'>{1}</span>)</td>", ranks[0].EloRanking, ifLoosePoints);
                writer.WriteLine("</tr>");
            }
            writer.WriteLine("</table>");

            if (user.RulerId == -1)
            {
                return;
            }

            Ruler ruler = Universe.instance.getRuler(user.RulerId);

            writer.WriteLine("<div class='planetInfoZoneTitle'>{0} - <b>{1}</b></div>",
                             info.getContent("information"), user.Nick
                             );

            writer.WriteLine("<table class='planetFrame'>");
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("battle_rank"));
            writer.WriteLine("<td class='resourceCell'><b>{0}</b>º</td>", (ruler.Rank == -1?"~":ruler.Rank.ToString()));
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("stats_alliances"));
            string allianceText = null;

            if (Universe.instance.isDefaultAlliance(ruler) || ruler.AllianceId < 0)
            {
                allianceText = "<i>" + info.getContent("no_alliance") + "</i>";
            }
            else
            {
                allianceText = AllianceUtility.Persistance.Get(ruler.AllianceId).Name;
            }
            writer.WriteLine("<td class='resourceCell'>{0}</td>", allianceText);
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("planetas"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Planets.Length);
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("victories"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Victories);
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("defeats"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.Defeats);
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("score"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", ruler.getResourceCount("score"));
            writer.WriteLine("</tr>");
            writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
            writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("battle_rank"));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", info.getContent(ruler.Ranking));
            writer.WriteLine("</tr>");

            if (current != null)
            {
                if (user.RulerId != current.RulerId)
                {
                    writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                    writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("battleAdminUser_friendly"));
                    writer.WriteLine("<td class='resourceCell'><a href='ruler/battle/friendlybattle/default.aspx?user={0}'>{1}</a></td>", user.Nick, info.getContent("battle_create"));
                    writer.WriteLine("</tr>");
                }

                if (current.IsInRole("admin"))
                {
                    writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                    writer.WriteLine("<td class='resource'>{0}</td>", info.getContent("batalhas"));
                    writer.WriteLine("<td class='resourceCell'><a href='admin/battleadmin/default.aspx?id={0}'>{1}</a></td>", ruler.Id, info.getContent("battleAdminUser_view"));
                    writer.WriteLine("</tr>");
                }
            }

            writer.WriteLine("</table>");

            if (ruler.Prizes == null || ruler.Prizes.Count == 0)
            {
                return;
            }

            writer.WriteLine("<div class='planetInfoZoneTitle'><b>{0}</b></div>",
                             info.getContent("section_prizes")
                             );

            writer.WriteLine("<table class='planetFrame'>");
            writer.WriteLine("<tr class='resourceTitle'>");
            writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("Medal"));
            writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("prize"));
            writer.WriteLine("<td class='resourceTitle'>{0}</td>", info.getContent("turn_current"));
            writer.WriteLine("</tr>");

            foreach (Winner winner in ruler.Prizes)
            {
                writer.WriteLine("<tr  onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                writer.WriteLine("<td class='resourceCell'><img src='{0}prizes/{1}{2}.gif' /></td>", OrionGlobals.getCommonImagePath(), OrionGlobals.getPrizeCategory(winner), winner.Medal.ToString());
                writer.WriteLine("<td class='resource'>{0}</td>", info.getContent(winner.Prize));
                writer.WriteLine("<td class='resourceCell'>{0}</td>", winner.Turn);
                writer.WriteLine("</tr>");
            }

            writer.WriteLine("</table>");
        }
Beispiel #49
0
        /// <summary>Pinta o controlo</summary>
        protected override void Render(HtmlTextWriter _writer)
        {
            try {
                writer = _writer;
                string locale = Request.QueryString["locale"];
                if (locale == null || locale == string.Empty)
                {
                    locale = "en";
                }
                string        url     = OrionGlobals.AlnitakUrl;
                ILanguageInfo info    = CultureModule.getLanguage(locale);
                int           rulerId = int.Parse(Request.QueryString["id"]);

                User  user  = UserUtility.bd.getUser(rulerId);
                Ruler ruler = null;
                if (user != null)
                {
                    ruler = Universe.instance.getRuler(user.RulerId);
                }

                Write("<div class=\"orionsbelt_title\">");
                Write("<a href=\"{0}\" class=\"orionsbelt_link\">Orion`s Belt</a></div>", url);
                if (ruler == null || user.RulerId == -1)
                {
                    Write(info.getContent("ruler_not_playing"));
                    return;
                }

                Write("<table class=\"orionsbelt_table\">");
                Write("<tr>");
                Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("name"));
                Write("<td class=\"orionsbelt_td\">{0}</td>", OrionGlobals.getCompleteLink(ruler).Replace("'", "\""));
                Write("</tr>");
                Write("<tr>");
                Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("stats_alliances"));
                string allianceText = null;
                if (Universe.instance.isDefaultAlliance(ruler))
                {
                    allianceText = "<i>" + info.getContent("no_alliance") + "</i>";
                }
                else
                {
                    allianceText = ruler.Alliance.Name;
                }
                Write("<td class=\"orionsbelt_td\">{0}</td>", allianceText);
                Write("</tr>");
                Write("<tr>");
                Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("planetas"));
                Write("<td class=\"orionsbelt_td\">{0}</td>", ruler.Planets.Length);
                Write("</tr>");
                Write("<tr>");
                Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("batalhas"));
                Write("<td class=\"orionsbelt_td\"><span class=\"green\">{0}</span>/<span class=\"orange\">{1}</span>/<span class=\"red\">{2}</span></td>", ruler.Victories, ruler.Draws, ruler.Defeats);
                Write("</tr>");
                Write("<tr>");
                Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("score"));
                Write("<td class=\"orionsbelt_td\">{0}</td>", ruler.getResourceCount("score"));
                Write("</tr>");
                Write("<tr>");
                Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("battle_rank"));
                Write("<td class=\"orionsbelt_td\"><b>{0}</b></td>", (ruler.Rank == -1?"~":ruler.Rank.ToString()));
                Write("</tr>");
                Write("</table>");
            } catch (Exception) {
                Write("<div class=\"orionsbelt_title\">Error processing the URL</div>");
            }
        }
Beispiel #50
0
 public GuidelineDiagonal(Ruler container)
     : base(container)
 {
     Info.Orientation = GuideOrientation.Diagonal;
     base.Cursor      = Cursors.SizeNWSE;
 }
Beispiel #51
0
 /// <summary>Inicializa o controlo de listagem de pesquisas</summary>
 private void initResearchOwned( Ruler ruler, ResourcesList resources )
 {
     resources.Manager = ruler;
     resources.Title = info.getContent("rulerResearch");
     resources.Category = "Research";
     resources.ShowImages = false;
     resources.ShowOnlyQuantity = true;
     resources.ShowZeroQuantity = false;
     resources.ShowQuantity = false;
     resources.ShowDocumentation = true;
 }
Beispiel #52
0
        /// <summary>Indica o texto só relativo a um user</summary>
        private static void getUserText( StringWriter writer, int userId, Ruler ruler )
        {
            string basePath = ImagePath + "skins/commonImages/prizes/";
            if( ruler != null && ruler.AllianceId > 0 ) {
                writer.Write("<img class='prize' src='{0}{1}.gif' />", basePath, ruler.AllianceRank);
            }
            if( isAdmin(userId) ) {
                writer.Write("<img class='prize' src='{0}Admin.gif' />", basePath);
                return;
            }

            if( isBetaTester(userId) ) {
                writer.Write("<img class='prize' src='{0}BetaTester.gif' />", basePath);
                return;
            }

            if( isArtist(userId) ) {
                writer.Write("<img class='prize' src='{0}Artist.gif' />", basePath);
            }
        }
Beispiel #53
0
 public override void ResolveStep(EcoBlock ecoblock)
 {
     Ruler ruler = (Ruler)ecoblock;
 }
Beispiel #54
0
        public static void RankingBattleEndend( Ruler one, Ruler two, BattleResult result )
        {
            try {
                User uone = UserUtility.bd.getUser(one.ForeignId);
                User utwo = UserUtility.bd.getUser(two.ForeignId);

                Ranking.Update( uone, utwo, result );

                if( result == BattleResult.NumberOneVictory ) {
                    ++uone.Wins;
                    ++utwo.Losses;
                } else {
                    ++utwo.Wins;
                    ++uone.Losses;
                }

                UserUtility.bd.saveUser(uone, string.Empty);
                UserUtility.bd.saveUser(utwo, string.Empty);

                if( uone.AllianceId > 0 && utwo.AllianceId > 0 && uone.AllianceId != utwo.AllianceId ) {
                    AllianceInfo aone = AllianceUtility.Persistance.Get(uone.AllianceId);
                    AllianceInfo atwo = AllianceUtility.Persistance.Get(utwo.AllianceId);

                    Ranking.Update(aone, atwo, result);

                    ++aone.RankingBattles;
                    ++atwo.RankingBattles;

                    AllianceUtility.Persistance.Save(aone);
                    AllianceUtility.Persistance.Save(atwo);
                }
            } catch( Exception ex ) {
                ExceptionLog.log(ex);
            }
        }
Beispiel #55
0
        /// <summary>Retorna um link completo para um ruler</summary>
        public static string getLink( Ruler ruler, string baseUrl )
        {
            StringWriter writer = new StringWriter();
            writer.Write("<a href='{2}userinfo.aspx?id={1}' class='{3}'>{0}</a>", ruler.Name, ruler.ForeignId, baseUrl, getUserCss(ruler.ForeignId));

            #if DEBUG
            writer.Write(" <span class='red'>(RId:{0})</span> ", ruler.Id);
            #endif

            if( ruler.InVacation ) {
                writer.Write("<img src={0} />", getCommonImagePath("prizes/vacation.gif"));
            }

            getUserText(writer, ruler.ForeignId, ruler);

            if( ruler.Prizes.Count == 0 ) {
                return writer.ToString();
            }

            Medal conquer = getBest(ruler, PrizeCategory.Conquer);
            Medal building = getBest(ruler, PrizeCategory.Building);
            Medal research = getBest(ruler, PrizeCategory.Research);
            string basePath = ImagePath + "skins/commonImages/prizes/";

            if( conquer != Medal.None ) {
                writer.Write("<img class='prize' src='{0}Conquer{1}.gif' />", basePath, conquer.ToString() );
            }
            if( building != Medal.None ) {
                writer.Write("<img class='prize' src='{0}Building{1}.gif' />", basePath, building.ToString() );
            }
            if( research != Medal.None ) {
                writer.Write("<img class='prize' src='{0}Research{1}.gif' />", basePath, research.ToString() );
            }

            return writer.ToString();
        }
Beispiel #56
0
        public SaveRulerDialog(Ruler ruler)
        {
            ThemedButton cancelButton;
            ThemedButton okButton;
            CheckBox     checkBox;
            EditBox      editBox;

            window = new Window(new WindowOptions {
                Title   = "Save Ruler",
                Visible = false,
                Style   = WindowStyle.Dialog,
            });
            WindowWidget rootWidget = new ThemedInvalidableWindowWidget(window)
            {
                LayoutBasedWindowSize = true,
                Padding = new Thickness(8),
                Layout  = new VBoxLayout {
                    Spacing = 16
                },
                Nodes =
                {
                    new Widget {
                        Layout = new TableLayout{
                            ColumnCount    = 2,
                            RowCount       = 2,
                            Spacing        = 8,
                            ColumnDefaults =
                            {
                                new DefaultLayoutCell(Alignment.RightCenter, 0.5f, 0),
                                new DefaultLayoutCell(Alignment.LeftCenter,     1, 0)
                            }
                        },
                        Nodes =
                        {
                            new ThemedSimpleText("Ruler name"),
                            (editBox = new ThemedEditBox{
                                MinWidth = 150
                            }),
                            new ThemedSimpleText("Anchor to root"),
                            (checkBox = new ThemedCheckBox())
                        }
                    },
                    new Widget {
                        Layout = new HBoxLayout{
                            Spacing = 8
                        },
                        LayoutCell = new LayoutCell(Alignment.RightCenter),
                        Nodes      =
                        {
                            (okButton     = new ThemedButton("Ok")),
                            (cancelButton = new ThemedButton("Cancel")),
                        }
                    }
                }
            };

            cancelButton.Clicked += window.Close;
            okButton.AddChangeWatcher(() => editBox.Text, (text) => okButton.Enabled = !string.IsNullOrEmpty(text));
            okButton.Clicked += () => {
                ruler.Name         = editBox.Text;
                ruler.AnchorToRoot = checkBox.Checked;
                result             = true;
                window.Close();
            };
            rootWidget.FocusScope = new KeyboardFocusScope(rootWidget);
            editBox.SetFocus();
        }
Beispiel #57
0
        public DiagramVM()
        {
            #region DiagramViewModel Properties , Commands Initialization

            ItemUnSelectedCommand = new Command(OnItemUnselectedCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            Theme = new SimpleTheme();

            DefaultConnectorType = ConnectorType.Orthogonal;

            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands | SelectorConstraints.HideDisabledResizer,
            };

            #endregion

            #region Node Creation

            NodeViewModel Node1 = CreateNode(65, 100, 200, 150, "Rectangle", "Publisher", true);
            NodeViewModel Node2 = CreateNode(65, 100, 450, 150, "Rectangle", "Completed Book", false);


            #endregion

            #region Port Creation

            CreateNodePort(Node1, "NodePort11", 0.5, 0, "In");
            CreateNodePort(Node1, "NodePort12", 0.5, 1, "Out");

            CreateNodePort(Node2, "NodePort21", 0.5, 0, "In");
            CreateNodePort(Node2, "NodePort22", 0.5, 1, "Out");

            #endregion

            #region NodeCollection

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);


            #endregion
        }
Beispiel #58
0
 public void ReCreateRulers()
 {
     topRuler   = new Ruler(Ruler.RulerPosition.TOP, project.ReportPage);
     leftRuler  = new Ruler(Ruler.RulerPosition.LEFT, project.ReportPage);
     guideRuler = new Ruler(Ruler.RulerPosition.GUIDE, project.ReportPage);
 }
Beispiel #59
0
 /// <summary>Traduz um Ruler para texto localizado</summary>
 public string translate( Ruler ruler )
 {
     return OrionGlobals.getLink(ruler);
 }
 public void SetSelectedRuler(Ruler ruler)
 {
     selectedRuler = ruler;
 }