public string Execute(string phrase)
        {
            string[] wordsToTranslate = phrase.Split(INPUT_WORD_SEPARATOR);

            //TODO: Cambiar a StringBuilder
            string result = string.Empty;

            for (int i = 0; i <= wordsToTranslate.Length - 1; i++)
            {
                string[] morseCodes = wordsToTranslate[i].Split(INPUT_CHAR_SEPARATOR);

                //TODO: Cambiar a StringBuilder
                string translatedWord = string.Empty;
                for (int l = 0; l <= morseCodes.Length - 1; l++)
                {
                    translatedWord += Telegraph.MapToAlphabeticalCharacter(morseCodes[l]);
                }

                if (!result.Equals(string.Empty))
                {
                    result += OUTPUT_WORD_SEPARATOR;
                }
                result += translatedWord;
            }

            return(result);
        }
        bool ShipComponentExperiment()
        {
            Telegraph telegraph = new Telegraph();

            //List<monocle.ShipData> ships = null;

            //if (!telegraph.GetAllShips(monocle.Area.OldWorld, out ships))
            // return false;

            for (ulong i = 0; i < 2048; ++i)
            {
                ulong address = 0;

                if (!telegraph.GetShipComponentAddress(0x200000FF8, i, out address))
                {
                    continue;
                }

                if (address == 0)
                {
                    continue;
                }

                string idString      = i.ToString();
                string addressString = address.ToString("X");

                Console.WriteLine(string.Format("{0} {1}", idString, addressString));
            }

            return(true);
        }
Beispiel #3
0
 private static void Postfix(Telegraph __instance, SongCues.Cue cue, float animationSpeed)
 {
     if (Config.HiddenClouds == true || ForceEnable == true || Config.CleanStacks)
     {
         if (cue.behavior == Target.TargetBehavior.Melee || cue.behavior == Target.TargetBehavior.Dodge)
         {
             return;
         }
         if (Config.CleanStacks)
         {
             if (cue.nextCue is null || cue.behavior == Target.TargetBehavior.ChainStart || cue.behavior == Target.TargetBehavior.Chain)
             {
                 return;
             }
             if (cue.nextCue.pitch == cue.pitch && (cue.nextCue.tick - cue.tick < 480))
             {
                 __instance.cloud.enabled = false;
                 hideNextCloud            = true;
                 return;
             }
             if (hideNextCloud)
             {
                 hideNextCloud            = false;
                 __instance.cloud.enabled = false;
             }
         }
         else
         {
             __instance.cloud.enabled = false;
         }
     }
 }
Beispiel #4
0
 public TelegraphService()
 {
     _telegraph = new Telegraph();
     IslandDetailsObservable = Observable
                               .Interval(TimeSpan.FromSeconds(2))
                               .Select(_ => GetIslandDetails());
 }
        public string Execute(string phrase)
        {
            string[] wordsToTranslate = phrase.Split(INPUT_WORD_SEPARATOR);

            //TODO: Cambiar a StringBuilder
            string result = string.Empty;

            for (int i = 0; i <= wordsToTranslate.Length - 1; i++)
            {
                char[] word = wordsToTranslate[i].ToCharArray();

                //TODO: Cambiar a StringBuilder
                string translatedWord = string.Empty;
                for (int l = 0; l <= word.Length - 1; l++)
                {
                    translatedWord += Telegraph.MapToMorseCharacter(word[l]);

                    if (l + 1 < word.Length)
                    {
                        translatedWord += OUTPUT_CHAR_SEPARATOR;
                    }
                }

                if (!result.Equals(string.Empty))
                {
                    result += OUTPUT_WORD_SEPARATOR;
                }
                result += translatedWord;
            }

            return(result);
        }
Beispiel #6
0
 private void tTelegraphItem_TelegrahAccessedEvent(Telegraph tTelegraph)
 {
     tTelegraph.TelegrahAccessedEvent -= new TelegrahAccessed(tTelegraphItem_TelegrahAccessedEvent);
     lock (((ICollection)m_TelegraphList).SyncRoot)
     {
         m_TelegraphList.Remove(tTelegraph);
     }
 }
        // GET api/Telegraph
        public IEnumerable <Telegraph> Get()
        {
            this.OnBeforeGet();
            var results = this.SDM.GetAllTelegraphs <Telegraph>();

            Telegraph.CheckExpand(this.SDM, results, HttpContext.Current.Request["expand"]);
            this.OnAfterGet(results);
            return(results);
        }
Beispiel #8
0
        private void button3_Click(object sender, EventArgs e)
        {
            var telegraph = new Telegraph();

            telegraph.InputMessage = textBox1.Text;

            var alphabet = this.listBox1.SelectedItem as Alphabet;

            alphabet.PlayTelegraph(telegraph);
        }
Beispiel #9
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject newTelegraph = Instantiate(telegraphObject, transform);

        this.telegraphObject = newTelegraph;

        this.telegraph           = this.telegraphObject.gameObject.GetComponent <Telegraph>();
        this.telegraphObject.tag = gameObject.tag;
        this.telegraphObject.SetActive(true);
    }
 // POST api/Telegraphs/{telegraph-guid}
 public Telegraph Put([FromBody] Telegraph telegraph)
 {
     if (telegraph.TelegraphId == Guid.Empty)
     {
         telegraph.TelegraphId = Guid.NewGuid();
     }
     this.OnBeforePut(telegraph);
     this.SDM.Upsert(telegraph);
     this.OnAfterPut(telegraph);
     return(telegraph);
 }
Beispiel #11
0
        //private SafeInvoker m_Invoker = new SafeInvoker();

        //! \brief constructor with single telegraph
        public TelegraphService(Telegraph tTelegraph)
            : base(new Telegraph[1] {
            tTelegraph
        })
        {
            if (null == tTelegraph)
            {
                m_Available = false;
            }

            Initialize();
        }
Beispiel #12
0
        //! \brief constructor with single telegraph
        public TelegraphService(Telegraph tTelegraph, System.Int32 tTimeOut)
            : base(new Telegraph[1] {
            tTelegraph
        }, tTimeOut)
        {
            if (null == tTelegraph)
            {
                m_Available = false;
            }

            Initialize();
        }
Beispiel #13
0
        void DemoAllIslands()
        {
            Telegraph telegraph = new Telegraph();

            if (!telegraph.GetAllIslands(out var allIslands))
            {
                Console.WriteLine("Couldn't find any islands");
                return;
            }


            Console.WriteLine(allIslands.Count);
            allIslands = allIslands.Where(island => island.name.Length > 0 && island.name.Length < 20).ToList();

            foreach (var island in allIslands)
            {
                Console.WriteLine($"\n\nFound island {island.name} - {island.id}");

                if (!telegraph.GetIslandConsumption(island.id, out var consumption))
                {
                    continue;
                }

                foreach (var con in consumption)
                {
                    Console.WriteLine($"{con.resourceType.ToString()} - {con.rate}");
                }

                if (!telegraph.GetIslandBuildings(island.id, out var buildings))
                {
                    continue;
                }

                // foreach (var building in buildings)
                // {
                //     Console.WriteLine($"{building.id} - {building.buidlingType} - {building.rawBuildingTypeID}");
                // }

                var validBuildings      = buildings.Where(b => b.buidlingType != Building.Invalid).ToList();
                var productionBuildings = validBuildings.Where(b => RDAHelper.GetProductionBuildings().Contains(b.buidlingType)).ToList();
                Console.WriteLine($"{buildings.Count} buildings ({validBuildings.Count} valid, {productionBuildings.Count} production)");

                foreach (var building in productionBuildings)
                {
                    if (!telegraph.GetBuildingProduction(island.id, building.id, out var productionNode))
                    {
                        continue;
                    }
                    Console.WriteLine($"Building {building.id} - {building.buidlingType.ToString()} - {productionNode.rate} {productionNode.output}");
                }
            }
        }
Beispiel #14
0
 private static void Postfix(Telegraph __instance, SongCues.Cue cue, float animationSpeed)
 {
     if (!hideTeles)
     {
         return;
     }
     if (cue.behavior == Target.TargetBehavior.Melee || cue.behavior == Target.TargetBehavior.Dodge)
     {
         return;
     }
     __instance.circleMesh.enabled = false;
     __instance.cloud.enabled      = false;
 }
Beispiel #15
0
        public override Boolean RegisterSupportTelegraph(Telegraph tTelegraph)
        {
            if (!(tTelegraph is SinglePhaseTelegraph))
            {
                return(false);
            }

            foreach (Telegraph tTelegraphItem in m_SupportTelegraphList)
            {
                if (tTelegraphItem.Type == tTelegraph.Type)
                {
                    return(false);
                }
            }

            m_SupportTelegraphList.Add(tTelegraph);

            return(true);
        }
 partial void OnBeforePut(Telegraph telegraph);
 partial void OnBeforeDelete(Telegraph telegraph);
        //! try to send telegraph(single phase)
        public override System.Boolean TryToSendTelegraph(Telegraph telTarget)
        {
            SinglePhaseTelegraph tempTelegraph = telTarget as SinglePhaseTelegraph;

            return(TryToSendTelegraph(tempTelegraph));
        }
 partial void OnAfterDelete(Telegraph telegraph);
Beispiel #20
0
 public Boolean TryToSendTelegraph(Telegraph telTarget)
 {
     return(m_TelegraphAdapter.TryToSendTelegraph(telTarget));
 }
 public SearchCheckTelegraph(Telegraph telegraph, UnitEntity caster)
 {
     this.telegraph = telegraph;
     this.caster    = caster;
 }
 partial void OnAfterGetById(Telegraph Telegraphs, Guid telegraphId);
 partial void OnAfterPut(Telegraph telegraph);
        private void CrawlfromXML(string xmlData, string movieName)
        {
            if (string.IsNullOrEmpty(xmlData))
            {
                return;
            }

            Crawler.MovieCrawler movieCrawler = new Crawler.MovieCrawler();
            JavaScriptSerializer json         = new JavaScriptSerializer();

            try
            {
                XmlDocument xdoc = new XmlDocument();

                #region Movie Crawler
                xdoc.LoadXml(xmlData);
                var movies = xdoc.SelectNodes("Movies/Month/Movie");
                if (movies == null)
                {
                    return;
                }

                foreach (XmlNode movie in movies)
                {
                    // Check movie name, we just need to crawl single movie and not all the movies present in XML file for current month
                    if (movie.Attributes["name"].Value.ToLower() != movieName.ToLower())
                    {
                        continue;
                    }

                    if (movie.Attributes["link"] != null && !string.IsNullOrEmpty(movie.Attributes["link"].Value))
                    {
                        try
                        {
                            List <string> critics = new List <string>();
                            #region Crawl Movie
                            MovieEntity  mov    = movieCrawler.Crawl(movie.Attributes["link"].Value);
                            TableManager tblMgr = new TableManager();
                            // Save the crawled content because in case of new movies, it fails
                            tblMgr.UpdateMovieById(mov);

                            string posterUrl = string.Empty;

                            if (movie.Attributes["santaposterlink"] != null && !string.IsNullOrEmpty(movie.Attributes["santaposterlink"].Value))
                            {
                                XMLMovieProperties prop = new XMLMovieProperties();
                                prop.SantaPosterLink = movie.Attributes["santaposterlink"].Value;
                                prop.MovieName       = mov.UniqueName;

                                CrawlPosters(json.Serialize(prop));
                            }

                            // Crawl Songs from Saavn

                            if (string.IsNullOrEmpty(mov.RowKey) || string.IsNullOrEmpty(mov.MovieId))
                            {
                                continue;
                            }

                            tblMgr.UpdateMovieById(mov);
                            #endregion

                            #region Crawl Movie Reviews
                            #region Crawler
                            try
                            {
                                BollywoodHungamaReviews bh = new BollywoodHungamaReviews();
                                HindustanTimesReviews   ht = new HindustanTimesReviews();
                                FilmfareReviews         ff = new FilmfareReviews();
                                CnnIbn         cibn        = new CnnIbn();
                                BoxOfficeIndia boi         = new BoxOfficeIndia();
                                Dna            dna         = new Dna();
                                FirstPost      fp          = new FirstPost();
                                IndianExpress  ie          = new IndianExpress();
                                KomalNahta     kn          = new KomalNahta();
                                MidDay         md          = new MidDay();
                                Ndtv           ndtv        = new Ndtv();
                                Rajasen        rs          = new Rajasen();
                                Rediff         rdf         = new Rediff();
                                Telegraph      tg          = new Telegraph();
                                TheHindu       th          = new TheHindu();
                                TimesOfIndia   toi         = new TimesOfIndia();
                                AnupamaChopra  ac          = new AnupamaChopra();
                                MumbaiMirror   mm          = new MumbaiMirror();

                                var reviews = movie.SelectNodes("Review");

                                List <ReviewEntity> reviewList = tblMgr.GetReviewByMovieId(mov.MovieId);

                                foreach (XmlNode review in reviews)
                                {
                                    ReviewEntity duplicateRE = reviewList.Find(r => r.Affiliation == review.Attributes["name"].Value);
                                    if (duplicateRE != null)
                                    {
                                        // We found the duplicate, skip this review to crawl
                                        continue;
                                    }

                                    ReviewEntity re         = new ReviewEntity();
                                    string       reviewLink = review.Attributes["link"].Value;

                                    switch (review.Attributes["name"].Value.Trim())
                                    {
                                    case "BollywoodHungama":
                                    case "Bollywood Hungama":
                                        re = bh.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Hindustan Times":
                                        re = ht.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Filmfare":
                                        re = ff.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "CNN IBN":
                                    case "CNNIBN":
                                        re = cibn.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Box Office India":
                                        re = boi.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "DNA":
                                        re = dna.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "FirstPost":
                                        re = fp.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Indian Express":
                                        re = ie.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Komal Nahta's Blog":
                                        re = kn.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Mid Day":
                                    case "MidDay":
                                        re = md.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "NDTV":
                                        re = ndtv.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "rajasen.com":
                                        re = rs.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Rediff":
                                        re = rdf.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Telegraph":
                                        re = tg.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "The Hindu":
                                        re = th.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Times of India":
                                        re = toi.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "anupamachopra.com":
                                        re = ac.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;

                                    case "Mumbai Mirror":
                                        re = mm.Crawl(reviewLink, review.Attributes["name"].Value);
                                        break;
                                    }

                                    if (re == null)
                                    {
                                        continue;
                                    }

                                    critics.Add(re.ReviewerName);

                                    // update the IDs - Movie Id, Reviewer Id etc.
                                    string reviewerId = ReviewCrawler.SetReviewer(re.ReviewerName, review.Attributes["name"].Value);
                                    //re.RowKey = re.ReviewId = new Guid().ToString();
                                    re.ReviewerId = reviewerId;
                                    re.MovieId    = mov.MovieId;
                                    re.OutLink    = reviewLink;
                                    tblMgr.UpdateReviewById(re);
                                }
                            }
                            catch (Exception)
                            {
                            }
                            #endregion
                            #endregion

                            #region Lucene Search Index
                            List <APIRole.UDT.Cast> casts   = json.Deserialize(mov.Cast, typeof(List <APIRole.UDT.Cast>)) as List <APIRole.UDT.Cast>;
                            List <String>           posters = json.Deserialize(mov.Posters, typeof(List <String>)) as List <String>;
                            List <String>           actors  = new List <string>();

                            if (casts != null)
                            {
                                foreach (var actor in casts)
                                {
                                    // actor, director, music, producer
                                    string role          = actor.role.ToLower();
                                    string characterName = string.IsNullOrEmpty(actor.charactername) ? string.Empty : actor.charactername;

                                    // Check if artist is already present in the list for some other role.
                                    // If yes, skip it. Also if the actor name is missing then skip the artist
                                    if (actors.Contains(actor.name) || string.IsNullOrEmpty(actor.name) || actor.name == "null")
                                    {
                                        continue;
                                    }

                                    // If we want to showcase main artists and not all, keep the following switch... case.
                                    switch (role)
                                    {
                                    case "actor":
                                        actors.Add(actor.name);
                                        break;

                                    case "producer":
                                        // some times producer are listed as line producer etc.
                                        // We are not interested in those artists as of now?! Hence skipping it
                                        if (characterName == role)
                                        {
                                            actors.Add(actor.name);
                                        }
                                        break;

                                    case "music":
                                    case "director":
                                        // Main music director and movie director does not have associated character name.
                                        // Where as other side directors have associated character name as associate director, assitant director.
                                        // Skipping such cases.
                                        if (string.IsNullOrEmpty(characterName))
                                        {
                                            actors.Add(actor.name);
                                        }
                                        break;
                                    }

                                    // If we want to showcase all the technicians
                                    //actors.Add(actor.name);
                                }
                            }

                            if (posters != null && posters.Count > 0)
                            {
                                posterUrl = posters[posters.Count - 1];
                            }

                            // include reviewer & their affiliation in index file
                            MovieSearchData movieSearchIndex = new MovieSearchData();
                            movieSearchIndex.Id            = mov.RowKey;
                            movieSearchIndex.Title         = mov.Name;
                            movieSearchIndex.Type          = mov.Genre;
                            movieSearchIndex.TitleImageURL = posterUrl;
                            movieSearchIndex.UniqueName    = mov.UniqueName;
                            movieSearchIndex.Description   = json.Serialize(actors);
                            movieSearchIndex.Critics       = json.Serialize(critics);
                            movieSearchIndex.Link          = mov.UniqueName;
                            LuceneSearch.AddUpdateLuceneIndex(movieSearchIndex);
                            #endregion
                        }
                        catch (Exception)
                        {
                            Debug.WriteLine("Error while crawling movie - " + movie.Attributes["link"].Value);
                        }
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception: {0}", ex);
                throw;
            }
        }
        void Demo()
        {
            {
                Telegraph telegraph = new Telegraph();

                monocle.GameTime gameTime;
                telegraph.GetGameTime(out gameTime);

                ShipMoveData shipMoveData;
                telegraph.GetShipMoveData(0x0000000200000FF8, out shipMoveData);

                telegraph.AddWaypoint(new List <ulong>()
                {
                    0x0000000200000FF8
                }, new Coordinate()
                {
                    x = 1111, y = 1616
                });

                //List<monocle.ShipData> ships;
                //List<monocle.IslandData> islands;

                //telegraph.GetAllShips(Area.OldWorld, out ships);
                //telegraph.GetIslandsByName("Shortisland", out islands);

                //List<monocle.ConsumptionNode> musliConsumption = null;
                //telegraph.GetIslandConsumption(islands.First().id, out musliConsumption);

                //// List with Orpheus' ID
                //List<ulong> Orpheus = new List<ulong>() { 0x0000000200000F88 };

                //// The target destination
                //Coordinate destination = new Coordinate() { x = 1111f, y = 1616f };

                //// Call user-facing part of function
                //telegraph.AddWaypoint(Orpheus, destination);

                return;

                //List<monocle.ConsumptionNode> musliConsumption;
                //telegraph.GetIslandConsumption(islands.FirstOrDefault().id, out musliConsumption);

                //List<monocle.BuildingData> buildings = new List<monocle.BuildingData>();
                //telegraph.GetIslandBuildings(islands.FirstOrDefault().id, out buildings);

                //monocle.BuildingData bakery;
                //bakery.id = 0;

                //foreach (var building in buildings)
                //{
                //    if (building.buidlingType == Building.Bakery)
                //    {
                //        bakery = building;
                //        break;
                //    }
                //}

                //monocle.ProductionNode production;
                //telegraph.GetBuildingProduction(islands.FirstOrDefault().id, bakery.id, out production);

                //for (ulong i = 0; i < 2048; ++i)
                //{
                //    ulong compAddress = 0;

                //    // telegraph.GetShipComponentAddress(0x0000000200000FF8, i, out compAddress);

                //    telegraph.GetBuildingComponentAddress(islands.FirstOrDefault().id, bakery.id, i, out compAddress);

                //    if (compAddress != 0)
                //    {
                //        string sAddress = compAddress.ToString("X");
                //        string sI = i.ToString();

                //        Console.WriteLine(string.Format("{0} {1}", sI, sAddress));
                //    }
                //}

                //List<ulong> ids = new List<ulong>();
                //ids.Add(ships[0].shipId);

                //telegraph.AddWaypoint(ids, new monocle.Coordinate { x = 1111, y = 1616});

                //List<TradeRoute> tradeRoutes;

                //telegraph.GetAllTradeRoutes(out tradeRoutes);

                //List<ShipData> oldWorldShips;
                //List<ShipData> newWorldShips;

                //telegraph.GetAllShips(Area.OldWorld, out oldWorldShips);
                //telegraph.GetAllShips(Area.NewWorld, out newWorldShips);

                //List<IslandData> islands = null;
                //telegraph.GetIslandsByName("musli", out islands);

                //var musli = islands.First();

                //List<ShipData> ships = null;
                //telegraph.GetAllShips(Area.OldWorld, out ships);

                //var goldenBehind = from ship in ships where ship.name.Equals("Golden Behind") select ship;

                //List < ConsumptionNode > musliconsumption;
                //telegraph.GetIslandConsumption(musli.id, out musliconsumption);
            }

            return;

            //// Initialize DirectInput
            //// var directInput = new DirectInput();

            //// Find a Joystick Guid
            //// var joystickGuid = Guid.Empty;

            //// foreach (var deviceInstance in directInput.GetDevices(DeviceType.Gamepad,
            ////             DeviceEnumerationFlags.AllDevices))
            ////     joystickGuid = deviceInstance.InstanceGuid;

            //// If Gamepad not found, look for a Joystick
            //// if (joystickGuid == Guid.Empty)
            ////         foreach (var deviceInstance in directInput.GetDevices(DeviceType.Joystick,
            ////                 DeviceEnumerationFlags.AllDevices))
            ////             joystickGuid = deviceInstance.InstanceGuid;

            //// If Joystick not found, throws an error
            //// if (joystickGuid == Guid.Empty)
            //// {
            ////     Console.WriteLine("No joystick/Gamepad found.");
            ////     Console.ReadKey();
            ////     Environment.Exit(1);
            //// }

            //// Instantiate the joystick
            ////var joystick = new Joystick(directInput, joystickGuid);

            //// Console.WriteLine("Found Joystick/Gamepad with GUID: {0}", joystickGuid);

            //// Query all suported ForceFeedback effects
            ////var allEffects = joystick.GetEffects();
            //// foreach (var effectInfo in allEffects)
            ////     Console.WriteLine("Effect available {0}", effectInfo.Name);

            //// Set BufferSize in order to use buffered data.
            ////joystick.Properties.BufferSize = 128;

            //// Acquire the joystick
            //// joystick.Acquire();

            //// monocle.Telegraph telegraph = new monocle.Telegraph();

            //// List<ShipData> oldWorldShips = new List<ShipData>();

            //// telegraph.GetAllShips(Area.OldWorld, out oldWorldShips);

            //// List<ulong> ships = new List<ulong>();
            //// ships.Add(oldWorldShips[5].shipId);

            //// ShipMoveData moveData;

            //// double x = 0;
            //// double y = 0;

            //// float dx = 0;
            //// float dy = 0;

            //// Poll events from joystick
            //// while (true)
            //// {
            ////     joystick.Poll();
            ////     var datas = joystick.GetBufferedData();
            ////     foreach (var state in datas)
            ////     {
            ////         if (state.Offset == JoystickOffset.Y)
            ////         {
            ////             y = ((double)state.Value / 65535.0 - .5) * 2.0;
            ////         }
            ////         else if (state.Offset == JoystickOffset.X)
            ////         {
            ////             x = ((double)state.Value / 65535.0 - .5) * 2.0;
            ////         }

            ////         Console.WriteLine(String.Format("{0} - {1}", x, y));
            ////     }

            ////     dx = (float)x * 20.0f;
            ////     dy = (float)y * 20.0f;

            ////     if (-.1 < x && x < .1)
            ////         dx = 0;

            ////     if (-.1 < y && y < .1)
            ////         dy = 0;

            ////     if (dx == 0.0f && dy == 0.0f)
            ////         continue;

            ////     telegraph.GetShipMoveData(ships.First(), out moveData);
            ////     telegraph.AddWaypoint(ships, new Coordinate() { x = moveData.position.x - dx, y = moveData.position.y + dy });
            //// }

            //// while (true)
            //// {
            ////     telegraph.GetShipMoveData(ships.First(), out moveData);
            ////     telegraph.AddWaypoint(ships, new Coordinate() { x = moveData.position.x + 10, y = moveData.position.y });
            //// }


            //// return;

            //// List<monocle.IslandData> islandData = new List<monocle.IslandData>();

            //// if (!telegraph.GetIslandsByName("Shortisland", out islandData))
            ////     return;

            //// monocle.IslandData island = islandData.First();

            //// List<monocle.BuildingData> buildings = new List<monocle.BuildingData>();

            //// if (!telegraph.GetIslandBuildings(islandData.First().id, out buildings))
            ////     return;

            //// foreach (var building in buildings)
            //// {
            ////     if (building.buidlingType == monocle.Building.SmallTradingPost)
            ////     {
            ////         for (ulong i = 0; i < 2048; ++i)
            ////         {
            ////             ulong compAddress = 0;

            ////             telegraph.GetBuildingComponentAddress(islandData.First().id, building.id, i, out compAddress);

            ////             if (compAddress != 0)
            ////             {
            ////                 string sAddress = compAddress.ToString("X");
            ////                 string sI = i.ToString();

            ////                 Console.WriteLine(string.Format("{0} {1}", sI, sAddress));
            ////             }
            ////         }
            ////     }


            ////     monocle.ProductionNode productionNode;

            ////     if (!telegraph.GetBuildingProduction(island.id, building.id, out productionNode))
            ////         continue;
            //// }

            //// List<monocle.ConsumptionNode> consumption = new List<monocle.ConsumptionNode>();

            //// if (!telegraph.GetIslandConsumption(island.id, out consumption))
            ////     return;

            //// List<monocle.ShipData> ships = new List<monocle.ShipData>();

            //// if (!telegraph.GetAllShips(monocle.Area.OldWorld, out ships))
            ////     return;

            //// ships = (from s in ships where s.shipType == monocle.ShipType.Clipper select s).ToList();

            //// monocle.ShipMoveData moveData;

            //// if (!telegraph.GetShipMoveData(ships.First().shipId, out moveData))
            ////     return;

            //// monocle.Coordinate target = moveData.position;
            //// target.x = target.x + 100;

            //// List<ulong> ids = (from s in ships select s.shipId).ToList();

            //// if (!telegraph.AddWaypoint(ids, target))
            ////     return;

            //// List<monocle.ShipCargoSlot> cargo = new List<monocle.ShipCargoSlot>();

            //// if (!telegraph.GetShipCargo(ids.First(), out cargo))
            ////     return;

            //// if (!telegraph.ShipDumpCargo(ids.First(), 1))
            ////     return;

            //// ulong address = 0;

            //// telegraph.GetShipComponentAddress(ids.First(), 253, out address);
        }
Beispiel #26
0
 //! implement interface ITelegraph : TryToSendTelegraph
 public Boolean TryToSendTelegraph(Telegraph telTarget)
 {
     return(TryToSendTelegraph(telTarget as SinglePhaseTelegraph));
 }
Beispiel #27
0
 public Telegrapher()
 {
     Telegraph.Initilize();
 }