Example #1
0
 public static void ShowMemento()
 {
     BlurCameraOverTime.Instance.BlurScreen();
     Chronos.PauseTime(0.05F);
     Chronos.LateExecute(MementoManager.ShowMemento, 0.6F);
     MementoManager.Instance.StartCoroutine(MementoManager.Instance.TriggerMemento(true));
 }
Example #2
0
    void OnTriggerEnter(Collider other)
    {
        if (!isCleared)
        {
            if (title == "")
            {
                DialogManager.dialogManager.LoadConversationByIndex(index);
            }
            else
            {
                DialogManager.dialogManager.LoadConversationByTitle(title);
            }

            DialogManager.dialogManager.SetAutoClose(false);


            if (pauseGameOnShowDialog)
            {
                PauseScreen.Instance.enabled = false;
                BlurCameraOverTime.Instance.BlurScreen();
                Chronos.PauseTime(0.05F);
                DialogManager.dialogManager.SetCallbackFunc(OnMessageEnd);
                Chronos.LateExecute(DialogManager.dialogManager.ShowDialogBox, 0.6F);
            }
            else
            {
                DialogManager.dialogManager.SetCallbackFunc(DefaultBehavior);
                DialogManager.dialogManager.ShowDialogBox();
            }

            isCleared = !canRepeat;
        }
    }
Example #3
0
        protected override bool LoadData()
        {
            string filepath = Filepath();

            if (!File.Exists(filepath))
            {
                Chronos chronos = new Chronos().Default();
                if (!DataService.TryWrite <Chronos>(chronos, out string error, filepath))
                {
                    OnFailure(error);
                }
            }
            bool b = DataService.TryRead <Chronos>(filepath, out Chronos model, out string message);

            if (!b)
            {
                OnFailure(message);
            }
            else
            {
                Model = model;
            }

            return(b);
        }
Example #4
0
    void AfterDeathDialog()
    {
        PauseScreen.Instance.enabled = true;
        BlurCameraOverTime.Instance.UnblurScreen();
        Chronos.ResumeTime(0.05F);

        GetComponent <IvyController>().enabled = false;

        IvyStun stun = GetComponent <IvyStun>();

        stun.allowInput = false;
        stun.range      = 25;
        stun.StartCoroutine("StunSphereAnimation");

        originalCameraTarget              = TP_Camera.Instance.target;
        originalXoffset                   = TP_Camera.Instance.desiredXOffset;
        TP_Camera.Instance.target         = transform;
        TP_Camera.Instance.desiredXOffset = 0;
        TP_Camera.Instance.useDamping     = true;

        GameObject.FindObjectOfType <Morbius>().ForceKill();

        StartCoroutine(DoPulse());
        StartCoroutine(KillAllEnemies());
    }
Example #5
0
 void Start()
 {
     DialogManager.dialogManager.LoadConversationByIndex(15);
     PauseScreen.Instance.enabled = false;
     BlurCameraOverTime.Instance.BlurScreen();
     Chronos.PauseTime(0.05F);
     DialogManager.dialogManager.SetCallbackFunc(AfterDeathDialog);
     Chronos.LateExecute(DialogManager.dialogManager.ShowDialogBox, 0.6F);
 }
Example #6
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 );
        }
Example #7
0
 // Update is called once per frame
 void Update()
 {
     if (Player.Instance.isDead && !running)
     {
         running = true;
         FadeToBlack.Instance.QueueNextOpacity(0);
         BlurCameraOverTime.Instance.BlurScreen();
         Chronos.LateExecute(LoadScene.Instance.ReloadScene, 5);
         Chronos.LateExecute(KillAllEnemiesCoroutine, 1);
     }
 }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        if (!playerDeathEventTriggered && Player.Instance.isDead)
        {
            playerDeathEventTriggered = true;
            FadeToBlack.Instance.QueueNextOpacity(0);
            StartCoroutine(KillAllEnemies());

            Chronos.LateExecute(LoadLevel01, 5);
        }
    }
Example #9
0
 // Start is called before the first frame update
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Example #10
0
        /// <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));
        }
 private void Awake()
 {
     if (Chronos.i != null)
     {
         Destroy(this);
     }
     else
     {
         i = this;
         // DontDestroyOnLoad(gameObject);
     }
 }
Example #12
0
    public void Collect()
    {
        BlurCameraOverTime.Instance.BlurScreen();
        Chronos.PauseTime(0.05F);
        Chronos.LateExecute(MementoManager.ShowMemento, 0.6F);
        MementoManager.IncrementPickupCount();
        MementoManager.Instance.StartCoroutine(MementoManager.Instance.TriggerMemento(true));

        foreach (ParticleToggle p in GetComponentsInChildren <ParticleToggle>())
        {
            p.ToggleParticles(false);
        }

        Destroy(gameObject, 0.1F);
    }
Example #13
0
    // Handles how messages are being displayed in the dialog box (eg. order of messages etc)
    private void HandleDialogBox()
    {
        // If the dialog box is currently active
        if (isShowing)
        {
            // If there is no co routine AND the user can continue to next line
            if (!isTyping && canContinue)
            {
                isTyping    = true;
                canContinue = false;

                // Start the co routine
                ProceedMessage();
            }

            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                // If the text is still typing AND the player presses proceed, display the full text
                if (isTyping)
                {
                    isTyping             = false;
                    allowTypewriterToRun = false;
                    currentText.text     = messageOrder[iterator - 1];
                }
                else
                {
                    canContinue = true;
                }
            }

            // Reached the last line of character speech
            if (iterator >= messageOrder.Count)
            {
                if (!isTyping && !alreadyClosing && autoCloseDialogBoxOnMessageEnd)
                {
                    alreadyClosing = true;
                    Chronos.LateExecute(HideDialogBox, 0.5f);
                }

                if (canContinue)
                {
                    //Call the callback func
                    onDialogEnd();
                    HideDialogBox();
                }
            }
        }
    }
Example #14
0
        public static ResultTies Search1(IList<byte> qext, Dictionary<int,double> acc, int numqgrams, LSC<IList<byte>> I, double probabilidad)
        {
            Chronos time = new Chronos();
            var aspace = (AudioSpace)I.MainSpace;
            int numsampleq = numqgrams;
            int skip = numqgrams/numsampleq;
            Random r = new Random();

            time.Begin();
            for(int sindex=0; sindex <numsampleq; sindex++){
                int qindex = sindex * skip;
                BinQGram qgram = new BinQGram(qext, qindex * aspace.SymbolSize, aspace.Q);
                IResult R = new Result(int.MaxValue, false);

                if(r.NextDouble() > probabilidad){
                    continue;
                }

                I.KNNSearch(qgram,-1,R);
                HashSet<int> docId = new HashSet<int>();

                foreach (var u in R){
                    docId.Add(aspace.GetDocIdFromBlockId(u.docid));
                }

                foreach (var d in docId){

                    double dist;
                    if(!acc.TryGetValue(d ,out dist)){
                        acc[d] = -1;
                    }
                    else{
                        acc[d]--;
                    }
                }
            }
            time.End();
            //time.PrintStats("Tiempo de busqueda");

            var Rf = new ResultTies(100 , false);
            foreach (var u in acc){
                Rf.Push(u.Key, u.Value);
            }

            return Rf;
        }
Example #15
0
    void TogglePause()
    {
        isPaused = !isPaused;

        if (isPaused)
        {
            BlurCameraOverTime.Instance.BlurScreen();
            Chronos.PauseTime(0.05F);
        }
        else
        {
            BlurCameraOverTime.Instance.UnblurScreen();
            Chronos.ResumeTime(0.05F);
        }

        pauseUI.interactable = isPaused;
    }
Example #16
0
        /// <summary>Preenche os controlos relativos a um recurso</summary>
        private void fillResourceType( string resource, Control control, Chronos.Core.Planet planet)
        {
            QueueItem item = planet.current(resource);

            Label type = (Label) control.FindControl("resource" + resource);
            if( type != null ) {
                if( item != null ) {
                    type.EnableViewState = false;
                    if( item == null ) {
                        type.Text = "-";
                    } else {
                        string resType = info.getContent(item.FactoryName);
                        type.Text = resType;
                    }
                } else {
                    type.Text = "-";
                }
            }

            Label queueCount = (Label) control.FindControl("queueCount" + resource);
            if( queueCount != null ) {
                queueCount.EnableViewState = false;
                queueCount.Text = planet.queueCount(resource).ToString();
            }

            Label quantity = (Label) control.FindControl("quantity" + resource);
            if( quantity != null ) {
                if( item != null ) {
                    quantity.EnableViewState = false;
                    quantity.Text = item.Quantity.ToString();
                } else {
                    quantity.Text = "-";
                }
            }

            Label toGo = (Label) control.FindControl("toGo" + resource);
            if( toGo != null ) {
                if( item != null ) {
                    toGo.EnableViewState = false;
                    toGo.Text = "+ " + item.RemainingTurns;
                } else {
                    toGo.Text = "-";
                }
            }
        }
Example #17
0
        /// <summary>Escreve as informações gerais de um planeta</summary>
        private void writeGeneral( Chronos.Core.Planet planet, Control control )
        {
            fillLabel(control, "name", planet.Name);
            fillLabel(control, "coordinate", planet.Coordinate.ToString() );
            fillLabel(control, "diameter", planet.Info.Diameter.ToString() );
            fillLabel(control, "mass", planet.Info.Mass.ToString() );
            fillLabel(control, "temperature", planet.Info.Temperature.ToString() );
            fillLabel(control, "escape", planet.Info.EscapeVelocity.ToString() );
            fillLabel(control, "terrain", info.getContent(planet.Info.Terrain.Description) );

            fillPanel(control, "mineral", (int)planet.ModifiersRatio["mp"]);
            fillPanel(control, "food", (int)planet.ModifiersRatio["food"]);
            fillPanel(control, "gold", (int)planet.ModifiersRatio["gold"]);
            fillPanel(control, "energy", (int)planet.ModifiersRatio["energy"]);
            fillPanel(control, "groundSpace", planet.getResourceCount("Intrinsic", "groundSpace") );
            fillPanel(control, "waterSpace", planet.getResourceCount("Intrinsic", "waterSpace") );
            fillPanel(control, "orbitSpace", planet.getResourceCount("Intrinsic", "orbitSpace") );
        }
Example #18
0
    /// <summary>
    /// Best way is to init your timer in the start, then add it when you need it
    /// But if you want create and add in the same time, you can use it
    /// </summary>
    /// <param name="from"> Always "this"</param>
    /// <param name="timebook">
    /// Choose the timebook :
    /// Global -> Always update
    /// Game -> update only in Game
    /// Menu -> update only in menu
    /// <returns>The Chronos just created</returns>
    public Chronos CreateSimpleChronos(object from, Timebook timebook = Timebook.Global)
    {
        Chronos newOne = new Chronos();

        Dictionary <object, List <TimeUp> > revelantTimebook = GetRelevantTimebook(timebook);

        if (revelantTimebook.ContainsKey(from))
        {
            revelantTimebook[from].Add(newOne);
        }
        else
        {
            List <TimeUp> list = new List <TimeUp>();
            list.Add(newOne);
            revelantTimebook.Add(from, list);
        }

        return(newOne);
    }
Example #19
0
        /// <summary>Preenche os controlos relativos a um recurso</summary>
        private void fillResource( string resource, Control control, Chronos.Core.Planet planet)
        {
            Label quantity = (Label) control.FindControl(resource + "Quantity");
            if( quantity != null ) {
                quantity.EnableViewState = false;
                int val = planet.getResourceCount(resource);
                quantity.Text = val.ToString();
                if( val < 0 ) {
                    quantity.CssClass = "error";
                }
            }

            Label ratio = (Label) control.FindControl(resource + "Ratio");
            if( ratio != null ) {
                ratio.EnableViewState = false;
                int val = planet.getRatio(resource);
                if( val > 0 ) {
                    ratio.Text = val.ToString() + "%";
                } else {
                    ratio.Text = "-";
                }
            }

            Label perTurn = (Label) control.FindControl(resource + "PerTurn");
            if( perTurn != null ) {
                perTurn.EnableViewState = false;
                int val = planet.getPerTurn("Intrinsic",resource);
                string str = val.ToString();

                if( val > 0 ) {
                    str = "+" + str;
                    perTurn.Text = str;
                } else if( val == 0 ) {
                    perTurn.Text = "-";
                } else {
                    perTurn.CssClass = "error";
                    perTurn.Text = str;
                }
            }
        }
Example #20
0
    // Update is called once per frame
    void Update()
    {
        if (boss.currentAttackStance == Morbius.AttackStance.BROKEN)
        {
            if (!playerPlannedDeathFlag && Player.Instance.isDead)
            {
                playerPlannedDeathFlag = true;

                Chronos.LateExecute(EndGameSequence, 2);

                bossAreaSpawner.enabled = false;
            }
        }
        else if (Player.Instance.isDead && !playerDeathEventTriggered && !playerPlannedDeathFlag)
        {
            playerDeathEventTriggered = true;
            FadeToBlack.Instance.QueueNextOpacity(0);
            BlurCameraOverTime.Instance.BlurScreen();
            Chronos.LateExecute(LoadScene.Instance.ReloadScene, 5);
            Chronos.LateExecute(KillAllEnemiesCoroutine, 1);
        }
    }
Example #21
0
        /// <summary>
        /// Main loop for the server. It should handle everything except login.
        /// </summary>
        /// <param name="runInterval">Frame time in miliseconds</param>
        public void run(long runInterval)
        {
            Chronos.setInterval(runInterval);      // sunucu dongusunu her 1 runInterval milisaniyede tamamlayacak.

            while (true)
            {
                try
                {
                    while (true)
                    {
                        Chronos.waitForTheRightMoment();    // fps yi ayarliyor.

                        processUserMessages();

                        stepAllGames();
                    }
                }
                catch (Exception e)
                {
                    Console.Write(e.ToString() + "\nStack Trace:\n" + e.StackTrace);
                }
            }
        }
Example #22
0
 private string FleetUniverseName(Chronos.Core.Fleet fleet)
 {
     if( fleet.IsInBattle) {
         return fleet.Name + " - " + info.getContent("fleet_inBattle");
     }
     return fleet.Name;
 }
Example #23
0
        public static void Run()
        {
            Chronos.setInterval(50);      // sunucu dongusunu her 50 milisaniyede tamamlayacak.

            while (true)
            {
                try
                {
                    while (true)
                    {
                        Chronos.waitForTheRightMoment();    // fps yi ayarliyor.
                        frameNumber++;

                        Client client;

                        while (justLeftClients.TryDequeue(out client))
                        {
                            if (clientUserMap.ContainsKey(client))
                            {
                                clientUserMap.Remove(client);
                            }
                            if (clientPlayerMap.ContainsKey(client))
                            {
                                clientPlayerMap.Remove(client);
                            }
                        }

                        //var tmp = arrivedMessages;  // mesajlari alip queue'ya atan koda yeni bir concurrentQueue verelim. o onu doldururken biz bunu bosaltalim.
                        //Interlocked.Exchange<ConcurrentQueue<MessageArrivedEventArgs>>(ref arrivedMessages, tmpArrivedMessages);    // TODO buranin fail olmayacagina emin ol.
                        //tmpArrivedMessages = tmp;
                        tmpArrivedMessages = arrivedMessages;

                        int maxMessagesPerIteration = 50;
                        MessageArrivedEventArgs messageArgs;
                        while (tmpArrivedMessages.TryDequeue(out messageArgs) && maxMessagesPerIteration-- > 0)
                        {
                            RawMessage message = messageArgs.message;
                            if (message.containsField("messageTypeId") == false)
                            {
                                continue;
                            }

                            IIncomingMessage incomingMessage;
                            if (TypeIdGenerator.incomingMessageIds.TryGetValue(message.getInt("messageTypeId"), out incomingMessage))
                            {
                                //Console.WriteLine(incomingMessage.GetType().Name);
                                incomingMessage.processMessage(messageArgs);
                            }
                        }

                        foreach (var arena in arenas)
                        {
                            arena.Update();
                        }
                        arenas.RemoveAll(a => a.awaitsDestruction);

                        queue.Update();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString() + "\nStack Trace:\n" + e.StackTrace);
                }
            }
        }
Example #24
0
 protected void Awake()
 {
     Instance = this;
 }
Example #25
0
 /// <summary>Construtor</summary>
 public ShowPlanetResources( Chronos.Core.Planet p )
 {
     planet = p;
 }
Example #26
0
 public static void HideMemento()
 {
     Chronos.ResumeTime(0.05F);
     BlurCameraOverTime.Instance.UnblurScreen();
     Instance.StartCoroutine(Instance.TriggerMemento(false));
 }
Example #27
0
        private void WriteHeader( HtmlTextWriter writer, Chronos.Core.Fleet fleet )
        {
            writer.WriteLine( "<table class='frame' width='400' cellpadding='0' cellspacing='0'><tr>" );

            writer.WriteLine(
                @"<td class='smallPadding' width='360'>
                    <img src='{0}' onClick=" +  "\"" + "show('fleet_{1}',this);\"" +@"/>
                    <b><span class='fleetName'>{2}</b>
                </td>
                ",OrionGlobals.getCommonImagePath( "plus.gif" ),fleet.Id,GetFleetName( fleet )
            );

            if( fleet.CanBeRemoved ) {
                writer.WriteLine( @"
                    <td align='left' width='40'>
                        {0}
                    </td>
                ", GetRemoveCode(fleet.Name) );
            }else {
                writer.WriteLine("<td></td>");
            }
        }
Example #28
0
 public void CreateSketch(IList<IList<int>> invindex, int maxvalue)
 {
     // after PermSortByFreq the invindex is permutated too
     var L = new IList<int>[invindex.Count];
     for (int i = 0; i < L.Length; i++) {
         L [i] = invindex [i];
     }
     this.PermSortByFreq (L, maxvalue);
     this.Sketch = new ListSDiff64 ();
     Console.WriteLine ("Creating sketch of the text");
     Chronos C = new Chronos ();
     C.Start ();
     var S = new InvIndexSketchBuilder (L, this.N);
     S.Build (this.Sketch, this.AlphabetBlock);
     C.End ();
     C.PrintStats ();
 }
Example #29
0
        private void WriteShips( HtmlTextWriter writer, Chronos.Core.Fleet fleet )
        {
            foreach( DictionaryEntry ship in fleet.Ships ) {
                string name = string.Empty ,quant = string.Empty;
                if( ship.Key != null ) {
                    name = ship.Key.ToString();
                }
                if( ship.Value != null ) {
                    quant = ship.Value.ToString();
                }

                writer.WriteLine(
                    @"<tr height='40'>
                        <td width='80' align='center' class='borderTop'>
                            <img src='{0}.gif' />
                        </td>
                        <td width='120' align='center' class='borderTop'>
                            {1}
                        </td>
                        <td width='200' align='center' class='borderTop smallPadding'>
                            {2}
                        </td>
                    </tr>",
                    OrionGlobals.getCommonImagePath( name.ToLower() ),
                    quant,
                    info.getContent(name)
                );
            }
        }
Example #30
0
 public FleetEventArgs( Chronos.Core.Fleet fleet )
 {
     _fleet = fleet;
 }
Example #31
0
        /// <summary>Escreve a lista de edificios</summary>
        private void writeBuildingList( Chronos.Core.Planet planet, Control planetSkin, string cat, bool keys )
        {
            Resources resources = (Resources) planetSkin.FindControl(cat);
            resources.Manager = planet;
            resources.ShowSpaceCost = true;
            resources.ShowDocumentation = true;
            resources.AllowKeywords = keys;
            resources.Tooltip = "modifiers";
            resources.Title = string.Format("<b>{0}</b> - {1}", info.getContent("recursos"), info.getContent(cat));
            resources.ShowDuration = true;
            resources.CategoryDescription = cat;
            resources.ShowDemolish = keys;

            QueueErrorReport queueError = (QueueErrorReport)planetSkin.FindControl("queueError");
            resources.QueueError = queueError;
        }
Example #32
0
 /// <summary>Regista um pedido no RequestManager</summary>
 public static void RegisterRequest( Chronos.Messaging.MessageType type, string caption )
 {
     RequestManager.Register(type, HttpContext.Current.Request.RawUrl, caption);
 }
Example #33
0
        private string GetFleetName( Chronos.Core.Fleet fleet )
        {
            if( fleet.IsDefenseFleet ) {
                return info.getContent("defenseFleet");
            }

            Planet planet = fleet.Owner as Planet;
            if( planet != null ) {
                return FleetPlanetName(planet, fleet.Name);
            }else {
                return FleetUniverseName(fleet);
            }
        }
 public SimpliciTIDriver()
 {
     this.chronos = new Chronos();
 }
Example #35
0
        private void WriteFleetInformation( HtmlTextWriter writer, Chronos.Core.Fleet fleet)
        {
            string state = info.getContent("fleet_state");
            string information = string.Empty;

            if( fleet.IsMoving ){
                state += info.getContent("fleet_inMovement");
                string arrival = string.Format(info.getContent("fleet_turnsToGo"), fleet.HoursToArrive );
                information = string.Format("<b>{0}:</b> {1}<br/>{2}", info.getContent("fleet_coordinate"), fleet.DestinyCoordinate.ToString(), arrival);
            }else{
                if( fleet.IsInBattle ) {
                    state += info.getContent("fleet_inBattle");
                    information = info.getContent("fleet_battleCoordinate") + fleet.Coordinate.ToString();
                }else{
                    if( fleet.IsMoveable ) {
                        state += info.getContent("fleet_stopped");
                        if( fleet.Owner is Planet ) {
                            Planet p = ((Planet)fleet.Owner);
                            string link = OrionGlobals.getSectionBaseUrl("Fleet") + "?id=" + p.Id;
                            information = string.Format( "{0}<a href='{1}'>{2}</a>", info.getContent("fleet_location"), link, p.Name );
                        } else {
                            information = info.getContent("fleet_location") + fleet.Coordinate.ToString();
                        }
                    }else{
                        return;
                    }
                }
            }

            writer.WriteLine( @"
                <tr>
                    <td class='borderTop' colspan='3' style='padding: 5px 0px 5px 0px;'>
                        {0}<br/>
                        {1}
                    </td>
                </tr>",state,information
            );
        }
Example #36
0
 /// <summary>
 /// Manage the build command
 /// </summary>
 /// <param name="args">
 /// Argument in command line syntax (--key value)
 /// </param>
 public static void Build(IEnumerable<string> args)
 {
     string indexclass = null;
     string spaceclass = null;
     string indexname = null;
     bool forcebuild = false;
     var op = new OptionSet () {
         {"indexclass=", "Build an index of class 'indexclass'", v => indexclass = v},
         {"indexname|index=", "Index name", v => indexname = v},
         {"spaceclass=", "Space's class", v => spaceclass = v},
         {"force", "Force to build", v => forcebuild = true}
     };
     op.Parse (args);
     if (indexclass == null || spaceclass == null || indexname == null) {
         Console.WriteLine ("--build options:");
         op.WriteOptionDescriptions (Console.Out);
         Console.WriteLine ();
         Console.WriteLine ("** The indexclass value must be one of the following: ");
         foreach (string iname in IndexLoader.IndexFactory.Keys) {
             Console.WriteLine ("{0}", iname);
         }
         List<IndexAttribute> Iattr = new List<IndexAttribute> ();
         List<SpaceAttribute> Sattr = new List<SpaceAttribute> ();
         foreach (Type E in typeof(Commands).Assembly.GetTypes()) {
             foreach (IndexAttribute itemI in E.GetCustomAttributes(typeof(IndexAttribute), true)) {
                 Iattr.Add (itemI);
             }
             foreach (SpaceAttribute itemS in E.GetCustomAttributes(typeof(SpaceAttribute), true)) {
                 Sattr.Add (itemS);
             }
         }
         Console.WriteLine ();
         Console.WriteLine ("** The spaceclass value must be one of the following: ");
         foreach (string iname in SpaceCache.SpaceFactory.Keys) {
             Console.WriteLine ("{0}", iname);
         }
         Console.WriteLine ();
         Console.WriteLine ("If you don't see the desired index or space, please ensure ");
         Console.WriteLine ("that there's a handler for it and to be in the plug-in path");
         throw new ArgumentException ("Some mandatory arguments were not given");
     }
     var C = new Chronos ();
     if (forcebuild || !File.Exists (indexname)) {
         Console.WriteLine ("Building {0}", indexname);
         Index idx = IndexLoader.Create (indexclass, spaceclass, null);
         C.Begin ();
         idx.Build (args);
         C.End ();
         Console.WriteLine ("=== Build time {0}", indexname);
         C.PrintStats ("build-time-");
     } else {
         Console.WriteLine ("Skipping {0} because already exists (--force to force build)", indexname);
     }
 }
Example #37
0
        private void WriteHiddenContent( HtmlTextWriter writer, Chronos.Core.Fleet fleet )
        {
            writer.WriteLine( "<tr><td colspan='2' ><table border='0' id='fleet_{0}' cellpadding='0' cellspacing='0' style='display:none;'>",fleet.Id );

            WriteFleetInformation(writer,fleet);

            writer.WriteLine(
                @"<tr>
                    <td align='center' class='borderTop'>
                        &nbsp;
                    </td>
                    <td align='center' class='borderTop'>
                        {0}
                    </td>
                    <td align='center' class='borderTop'>
                        {1}
                    </td>
                </tr>",info.getContent( "fleet_quant" ),info.getContent( "fleet_type" )
            );

            WriteShips(writer,fleet);

            writer.WriteLine( "</table></td></tr>" );
        }
Example #38
0
        public static void testLSHV(string listname, string qlist, int Q, int S)
        {
            int porcen=0;
            int numconsult=0;
            Console.WriteLine("<-- Building LSH Multiple Tables -->");
            string indexName = string.Format("Index.LSC.Prueba.xml");
            HammingMLSC I;
            if (!File.Exists(indexName)) {
                I = new HammingMLSC();
                I.SeqBuilder = SequenceBuilders.GetSeqXLB_SArray64 (16);
                if (! (File.Exists(listname + ".header"))) {
                    var A = new AudioSpace();
                    A.Build(listname, 30*3, 3);
                }
                I.Build(indexName,"audio-space",listname,20,1);
            }
            I = IndexLoader.Load(indexName) as HammingMLSC;

            Console.WriteLine("<-- Searching first object -->");
            var aspace = (AudioSpace)I.MainSpace;
            Chronos tiempo = new Chronos();

            foreach (var qname in (new QueryStream(qlist)).Iterate()) {
                numconsult++;
                Console.WriteLine ("<<<--- Inizializing query --->>>");
                tiempo.Start();
                var R = SearchAudio (qname, aspace,I);
                tiempo.End();

                if(R.Count>0){
                    porcen++;
                }
                Console.WriteLine ("qname: {0}",qname.QRaw);
                tiempo.PrintStats("****Tiempo de consulta****");

                var qext = BinaryHammingSpace.ParseAndLoadFromFile(qname.QRaw,false);

                foreach ( var p in R){
                    Console.WriteLine ("docid: {0}, dist: {1}, name: {2}",p.docid, p.dist, aspace.GetNameFromDocId(p.docid));
                    var audio = aspace.GetAudio(p.docid);
                    var distanciaHamming = BinaryHammingSpace.DistMinHamming(audio,qext,aspace.SymbolSize);
                    Console.WriteLine ("***********DocId:  {0}, Distancia BinaryHamming: {1}***************",p.docid, distanciaHamming);
                    Console.WriteLine ("***********Error: {0}%",distanciaHamming/(qext.Count/aspace.SymbolSize * 24)*100);
                }
                Console.WriteLine ("<<<--- Finalizing query --->>>");
            }

            Console.WriteLine("Porcentaje de respuesta: {0}%",porcen*100/numconsult);
        }
Example #39
0
        public void handleSimpliciTI()
        {
            chron = new Chronos();

            while (true)
            {
                try
                {
                    chron.OpenComPort(chron.GetComPortName());
                    writeLog("Found access point on port: " + chron.GetComPortName());
                    break;
                }
                catch (Exception)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }

            chron.StartSimpliciTI();

            writeLog("SimpliciTI started");

            while (true)
            {
                uint data;
                if (!chron.GetData(out data))
                {
                    break;
                }

                if (data != 0xFF)
                {
                    writeLog("Got data: " + data);
                }

                //Star
                if (data == 2)
                {
                    key.pressKey(0x44);
                }
                if (data == 3)
                {
                    key.releaseKey(0x44);
                }

                //NUM
                if (data == 4)
                {
                    key.pressKey(0x41);
                }
                if (data == 5)
                {
                    key.releaseKey(0x41);
                }

                //UP
                if (data == 6)
                {
                    key.pressKey(0x57);
                }
                if (data == 7)
                {
                    key.releaseKey(0x57);
                }
            }

            writeLog("Error!");
        }
Example #40
0
 void OnMessageEnd()
 {
     PauseScreen.Instance.enabled = true;
     BlurCameraOverTime.Instance.UnblurScreen();
     Chronos.ResumeTime(0.05F);
 }
Example #41
0
        /// <summary>Escreve um planeta</summary>
        private void writePlanet( Chronos.Core.Planet planet )
        {
            MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
            string control = OrionGlobals.AppPath + masterSkinInfo.masterSkinName + "/controls/" + controlToLoad;

            Control planetPage = Page.LoadControl(control);

            Image img = (Image) planetPage.FindControl("img");
            if( img != null ) {
                img.ImageUrl = OrionGlobals.getCommonImagePath("planets/" + planet.Info.Id + ".jpg");
                img.EnableViewState = false;
            }

            ResourcesList resources = (ResourcesList)planetPage.FindControl("resourcesList");
            if( resources != null ) {
                resources.Manager = planet;
                resources.Title = info.getContent("planetResources");
                resources.Category = "Intrinsic";
                resources.ShowImages = true;
                resources.ShowOnlyQuantity = false;
                resources.ShowZeroQuantity = true;
                resources.ShowDocumentation = false;
            }

            writeGeneral(planet, planetPage);

            Controls.Add(planetPage);
        }
Example #42
0
        private bool FillFleet( ItemsTable table, Chronos.Core.Fleet f1, string type)
        {
            ArrayList unitNames = (ArrayList) allUnits[type];
            for( int i = 0 ; i < unitNames.Count; ++i ) {
                string textBoxText = table.getSpecificText( i,2 );
                if( string.Empty == textBoxText ) {
                    continue;
                }

                string unit = unitNames[i].ToString( );

                try {
                    if( OrionGlobals.isInt( textBoxText.ToString() ) ) {
                        //Resource r = GetUnitResource(unit,"Unit");
                        int quant = int.Parse( textBoxText.ToString());
                        if( 0 == quant )
                            continue;
                        f1.addShip( unit, quant);
                    }else {
                        Information.AddError(info.getContent("battle_noInt"));
                        return false;
                    }
                }catch( OverflowException ) {
                    Information.AddError(string.Format(info.getContent("battle_IntToBig"),unit) );
                    return false;
                }
            }
            return true;
        }