示例#1
0
        internal static async Task <List <string> > GetSystemRomsAsync(string systemName)
        {
            if (!SystemRoms.ContainsKey(systemName))
            {
                SystemRoms[systemName] = new HashSet <string>();
            }

            var romNames = SystemRoms[systemName];

            foreach (var system in SystemList.Where(s => s.Name == systemName))
            {
                if (system.Roms == null)
                {
                    await system.GetRomsAsync();
                }


                foreach (var rom in system.Roms)
                {
                    romNames.Add(rom.Name);
                }
            }
            var output = romNames.ToList();

            output.Sort();
            return(output);
        }
 public async void TappedCommand(LoaclItemOfTaskDto dto)
 {
     try
     {
         if (SystemList == null || SystemList.Count == 0)
         {
             return;
         }
         if (null != SystemDto)
         {
             int seq = SystemDto.SeqNo;
             LoaclItemOfTaskDto currentDto = SystemList.Where(p => p.SeqNo == seq &&
                                                              p.TPId == SystemDto.TPId &&
                                                              p.TIId == SystemDto.TIId).FirstOrDefault();
             try
             {
                 await Navigation.PushAsync <LocalRegistScoreViewModel>((vm, v) => vm.Init(SystemList, currentDto), true);
             }
             catch (Exception)
             {
             }
         }
     }
     catch (Exception)
     {
     }
 }
示例#3
0
		/// <summary>
		/// Updates player available information and manages resource
		/// usage.
		/// </summary>
		private void UpdateLogs()
		{
			SystemList sysList = _gameData.SystemList;
			int count = _gameData.PlayerList.Count;
			for(int i = 0; i < count; i++)
				_gameData.PlayerList[i].SystemLog.Update(sysList);


		}
示例#4
0
 public SystemLog(SystemList sysList, int ID)
 {
     _playerID = ID;
     _aSysInfo = new SystemInfo[sysList.Count];
     for (int i = 0; i < sysList.Count; i++)
     {
         _aSysInfo[i] = new SystemInfo(sysList[i].MapLocation, sysList[i].Type);
     }
 }
示例#5
0
 public SystemInfoDialog(RemoteSystem _info, SystemList _list)
     : base()
 {
     Info = _info;
     SystemList = _list;
     this.Build ();
     this.LoadGateways ();
     this.LoadProtocols ();
     this.Populate ();
 }
示例#6
0
		/// <summary>
		/// Create a new game
		/// </summary>
		/// <param name="players"></param>
		/// <param name="mapWidth"></param>
		/// <param name="mapHeight"></param>
		/// <param name="systems"></param>
		public GameModel(int players, int mapWidth, int mapHeight, int systems)
		{
			Point wormhole = new Point(mapWidth/2, mapHeight/2);
			SystemList systemList = new SystemList(systems,players);
			PlayerList playerList = new PlayerList(players,wormhole);
			DataMap dataMap = new DataMap(mapWidth, mapHeight, systemList, wormhole);
			_gameData = new GameData( dataMap, systemList, playerList);
			playerList.GenLogs(systemList);
			
		}
示例#7
0
    private async Task LoadMoreBugs()
    {
        var bugs = await bugService.GetPaginatedBugs(BugsList.Count(), 200);

        BugsList.AddRange(bugs.Bugs);
        TotalCount = bugs.TotalCount;
        BugsList   = BugsList.Distinct().ToList();
        SystemList.AddRange(BugsList.Select(v => v.System));
        StateHasChanged();
    }
        /// <summary>
        /// Gets a new system list.
        /// </summary>
        public static void RefreshSystemList()
        {
            // Do not perform schema validation since we don't want to be forced into redeploying Program Runner after every schema change. We also don't have access
            // to the schema on non-development machines.
            var cacheFilePath = EwlStatics.CombinePaths(ConfigurationStatics.EwlFolderPath, "System List.xml");
            var cacheUsed     = false;

            try {
                ConfigurationLogic.ExecuteWithSystemManagerClient(
                    client => {
                    Task.Run(
                        async() => {
                        using (var response = await client.GetAsync("system-list", HttpCompletionOption.ResponseHeadersRead)) {
                            response.EnsureSuccessStatusCode();
                            using (var stream = await response.Content.ReadAsStreamAsync())
                                RsisSystemList = XmlOps.DeserializeFromStream <SystemList>(stream, false);
                        }
                    })
                    .Wait();
                });
            }
            catch (Exception e) {
                // Use the cached version of the system list if it is available.
                if (File.Exists(cacheFilePath))
                {
                    RsisSystemList = XmlOps.DeserializeFromFile <SystemList>(cacheFilePath, false);
                    cacheUsed      = true;
                }
                else
                {
                    throw new UserCorrectableException("Failed to download the system list and a cached version is not available.", e);
                }
            }

            StatusStatics.SetStatus(
                cacheUsed ? "Failed to download the system list; loaded a cached version from \"{0}\".".FormatWith(cacheFilePath) : "Downloaded the system list.");

            // Cache the system list so something is available in the future if the machine is offline.
            try {
                XmlOps.SerializeIntoFile(RsisSystemList, cacheFilePath);
            }
            catch (Exception e) {
                const string generalMessage = "Failed to cache the system list on disk.";
                if (e is UnauthorizedAccessException)
                {
                    throw new UserCorrectableException(generalMessage + " If the program is running as a non built in administrator, you may need to disable UAC.", e);
                }

                // An IOException probably means the file is locked. In this case we want to ignore the problem and move on.
                if (!(e is IOException))
                {
                    throw new UserCorrectableException(generalMessage, e);
                }
            }
        }
示例#9
0
 public void Update(SystemList sysList)
 {
     for (int i = 0; i < sysList.Count; i++)
     {
         int infPercentage = sysList[i].GetInfluencePercentage(_playerID);
         _aSysInfo[i].InfPercent = infPercentage;
         if (!sysList[i].HasCollected(_playerID))
         {
             _aSysInfo[i].ClearCollectedResources();
         }
     }
 }
 /// <summary>
 /// 删除命令
 /// </summary>
 /// <returns></returns>
 public override void ExecuteDelete()
 {
     if (SelectedSystem != null)
     {
         SystemInfoBLL bll = new SystemInfoBLL();
         if (bll.DeleteSystemInfo(SelectedSystem))
         {
             SystemList.Remove(SelectedSystem);
             SelectedSystem = null;
         }
     }
 }
        public int getSystemListId(string KeyName)
        {
            SystemList systemName = getSystemListByName(KeyName);

            if (systemName != null)
            {
                return(systemName.Id);
            }
            else
            {
                return(0);
            }
        }
        /// <summary>
        /// 新增命令
        /// </summary>
        /// <returns></returns>
        public override void ExecuteAdd()
        {
            Sys_Systems system = new Sys_Systems();

            system.ID = SystemList.Max(p => p.ID) + 1;
            FrmSystemSettingEdit edit = new FrmSystemSettingEdit(system);

            edit.SaveEvent += (sys) =>
            {
                SystemList.Add(sys);
            };
            edit.ShowDialog();
        }
示例#13
0
 //Sort the System List by Name from A to Z
 public void SortSystems()
 {
     logger.Trace("Sorting Systems By Name");
     try
     {
         SystemList = new ObservableCollection <PinballSystem>(SystemList.OrderBy(i => i.Name));
     }
     catch (Exception e)
     {
         logger.Error(e, "SortSytems Error");
         throw;
     }
 }
        public List <SystemListValue> getAllSystemValueListByKeyName(string KeyName)
        {
            SystemList systemName = getSystemListByName(KeyName);

            if (systemName != null)
            {
                return(getAllSystemValueListByNameId(systemName.Id));
            }
            else
            {
                return(null);
            }
        }
示例#15
0
        internal static List <string> GetSystemRoms(string systemName)
        {
            HashSet <string> romNames = new HashSet <string>();

            foreach (var system in SystemList.Where(s => s.Name == systemName))
            {
                system.Roms?.ForEach(rom => romNames.Add(rom.Name));
            }

            var output = romNames.ToList();

            output.Sort();
            return(output);
        }
示例#16
0
        internal static List <Rom> GetRomsByName(string systemName, string romName)
        {
            List <Rom> output = new List <Rom>();

            foreach (var system in SystemList.Where(s => s.Name == systemName))
            {
                var matchingRoms = system.Roms?.Where(rom => romName == rom.Name);
                foreach (var rom in matchingRoms)
                {
                    output.Add(rom);
                }
            }
            return(output);
        }
示例#17
0
        private void GoRegistScore(ItemOfTaskDto dto)
        {
            try
            {
                if (SystemList == null || SystemList.Count == 0)
                {
                    return;
                }

                if (null != dto)
                {
                    int           seq        = dto.SeqNo;
                    ItemOfTaskDto currentDto = SystemList.Where(p => p.SeqNo == seq &&
                                                                p.TPId == dto.TPId &&
                                                                p.TIId == dto.TIId).FirstOrDefault();
                    //int index = SystemList.IndexOf(currentDto);

                    //if (index == -1)
                    //{
                    //    _commonFun.AlertLongText("获取索引失败");
                    //    return;
                    //}

                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        //await Navigation.PushAsync<RegistScoreViewModel>(true);
                        //SystemList.FirstOrDefault().CurrentIndex = index;
                        //MessagingCenter.Send<List<ItemOfTaskDto>>(SystemList, "PassSystemList");
                        try
                        {
                            if (currentDto.IsClicked)
                            {
                                await Navigation.PushAsync <RegistScoreViewModel>((vm, v) => vm.Init(SystemList, currentDto), true);
                            }
                            else
                            {
                                await Navigation.PushAsync <ViewRegistScoreViewModel>((vm, v) => vm.Init(SystemList, currentDto), true);
                            }
                        }
                        catch (Exception)
                        {
                        }
                    });
                }
            }
            catch (Exception)
            {
            }
        }
示例#18
0
        /// <summary>
        /// Gets a new system list from RSIS.
        /// </summary>
        public static void RefreshSystemList()
        {
            // When deserializing the system list below, do not perform schema validation since we don't want to be forced into redeploying Program Runner after every
            // schema change. We also don't have access to the schema on non-development machines.
            var cachedSystemListFilePath = EwlStatics.CombinePaths(ConfigurationStatics.RedStaplerFolderPath, "RSIS System List.xml");

            try {
                var serializedSystemList =
                    ConfigurationLogic.ExecuteProgramRunnerUnstreamedServiceMethod(
                        channel => channel.GetSystemList(ConfigurationLogic.AuthenticationKey),
                        "system list download");
                RsisSystemList = XmlOps.DeserializeFromString <SystemList>(serializedSystemList, false);

                // Cache the system list so something is available in the future if the machine is offline.
                try {
                    XmlOps.SerializeIntoFile(RsisSystemList, cachedSystemListFilePath);
                }
                catch (Exception e) {
                    const string generalMessage = "The RSIS system list cannot be cached on disk.";
                    if (e is UnauthorizedAccessException)
                    {
                        throw new UserCorrectableException(generalMessage + " If the program is running as a non built in administrator, you may need to disable UAC.", e);
                    }

                    // An IOException probably means the file is locked. In this case we want to ignore the problem and move on.
                    if (!(e is IOException))
                    {
                        throw new UserCorrectableException(generalMessage, e);
                    }
                }
            }
            catch (UserCorrectableException e) {
                if (e.InnerException == null || !(e.InnerException is EndpointNotFoundException))
                {
                    throw;
                }

                // Use the cached version of the system list if it is available.
                if (File.Exists(cachedSystemListFilePath))
                {
                    RsisSystemList = XmlOps.DeserializeFromFile <SystemList>(cachedSystemListFilePath, false);
                }
                else
                {
                    throw new UserCorrectableException("RSIS cannot be reached to download the system list and a cached version is not available.", e);
                }
            }
        }
        public void SaveData(int Id, string ListName, string[] ListValue, int UserId)
        {
            if (Id > 0)
            {
                foreach (var item in ListValue)
                {
                    SystemListValue SystemListValue = new SystemListValue();
                    SystemListValue.SystemListID         = Id;
                    SystemListValue.Value                = item;
                    SystemListValue.Archived             = false;
                    SystemListValue.UserIDCreatedBy      = UserId;
                    SystemListValue.CreatedDate          = DateTime.Now;
                    SystemListValue.UserIDLastModifiedBy = UserId;
                    SystemListValue.LastModified         = DateTime.Now;
                    SystemListValue.Description          = "";
                    _db.SystemListValues.Add(SystemListValue);
                    _db.SaveChanges();
                }
            }
            else
            {
                SystemList SystemLists = new SystemList();
                SystemLists.SystemListName       = ListName;
                SystemLists.Archived             = false;
                SystemLists.UserIDCreatedBy      = UserId;
                SystemLists.CreatedDate          = DateTime.Now;
                SystemLists.UserIDLastModifiedBy = UserId;
                SystemLists.LastModified         = DateTime.Now;
                _db.SystemLists.Add(SystemLists);
                _db.SaveChanges();

                foreach (var item in ListValue)
                {
                    SystemListValue SystemListValue = new SystemListValue();
                    SystemListValue.SystemListID         = SystemLists.Id;
                    SystemListValue.Value                = item;
                    SystemListValue.Archived             = false;
                    SystemListValue.UserIDCreatedBy      = UserId;
                    SystemListValue.CreatedDate          = DateTime.Now;
                    SystemListValue.UserIDLastModifiedBy = UserId;
                    SystemListValue.LastModified         = DateTime.Now;
                    SystemListValue.Description          = "";
                    _db.SystemListValues.Add(SystemListValue);
                    _db.SaveChanges();
                }
            }
        }
示例#20
0
    void Start()
    {
        sl = JsonUtility.FromJson <SystemList>(jsonString);
        SetInitialValues();
        revolutionSpeed = float.Parse(val.orginalvalues.rotation_speed);
        allCenter       = new GameObject();
        int   sunScaleRelative  = 695500;
        long  austronamicalUnit = 149597870;
        float year         = 365;
        int   earth_mass   = 1;
        int   earth_radius = 6371;

        allCenter.name = "all systems";
        var systemOffset  = new Vector3(0, 0, 0);
        var oneOffset     = new Vector3(0, -30, 0);
        int total_systems = sl.Systems.Count;

        string[] sol = new string[7];
        for (int i = 0; i < total_systems; i++)
        {
            int z = 0;
            sol[z++] = (float.Parse(sl.Systems[i].sunScale) * sunScaleRelative).ToString();
            sol[z++] = sl.Systems[i].sunName;
            sol[z++] = sl.Systems[i].sunTexture;
            sol[z++] = sl.Systems[i].sunVar;
            sol[z++] = sl.Systems[i].sunHabitat;
            sol[z++] = sl.Systems[i].lightYears;
            sol[z++] = sl.Systems[i].discoveryMethod;
            int planet_count = sl.Systems[i].Planets.Count;
            string[,] planets = new string[planet_count, 6];
            for (int j = 0; j < planet_count; j++)
            {
                z = 0;
                planets[j, z++] = (float.Parse(sl.Systems[i].Planets[j].planetDistance) * austronamicalUnit).ToString();
                planets[j, z++] = sl.Systems[i].Planets[j].planetSize;
                planets[j, z++] = (float.Parse(sl.Systems[i].Planets[j].planetSpeed) / year).ToString();
                planets[j, z++] = sl.Systems[i].Planets[j].textureName;
                planets[j, z++] = sl.Systems[i].Planets[j].planetName;
                planets[j, z++] = sl.Systems[i].Planets[j].planetMass;
            }
            dealWithSystem(sol, planets, systemOffset, allCenter);
            systemOffset += oneOffset;
        }
        allCenter.transform.localScale = new Vector3(0.1F, 0.1F, 0.1F);
        k = 0;
        //        dealWithBinarySystem(allCenter);
    }
示例#21
0
    public void dealWithBinarySystem(GameObject all)
    {
        string     jsonString_binary = File.ReadAllText("Assets/Resources/binary_system_information.json");
        SystemList sl_binary         = JsonUtility.FromJson <SystemList>(jsonString_binary);

        allCenter = new GameObject();
        allCenter.transform.parent = all.transform;
        int   sunScaleRelative  = 695500;
        long  austronamicalUnit = 149597870;
        float year         = 365;
        int   earth_mass   = 1;
        int   earth_radius = 6371;

        allCenter.name = "all systems";
        int total_systems = sl_binary.Systems.Count;

        string[] sol          = new string[7];
        Vector3  systemOffset = new Vector3(-50f, -50f, -50f);
        Vector3  oneOffset    = new Vector3(0f, -30f, 0f);

        for (int i = 0; i < total_systems; i++)
        {
            int z = 0;
            sol[z++] = (float.Parse(sl.Systems[i].sunScale) * sunScaleRelative).ToString();
            sol[z++] = sl_binary.Systems[i].sunName;
            sol[z++] = sl_binary.Systems[i].sunTexture;
            sol[z++] = sl_binary.Systems[i].sunVar;
            sol[z++] = sl_binary.Systems[i].sunHabitat;
            sol[z++] = sl_binary.Systems[i].lightYears;
            sol[z++] = sl_binary.Systems[i].discoveryMethod;
            int planet_count = sl_binary.Systems[i].Planets.Count;
            string[,] planets = new string[planet_count, 6];
            for (int j = 0; j < planet_count; j++)
            {
                z = 0;
                planets[j, z++] = (float.Parse(sl_binary.Systems[i].Planets[j].planetDistance) * austronamicalUnit).ToString();
                planets[j, z++] = sl_binary.Systems[i].Planets[j].planetSize;
                planets[j, z++] = (float.Parse(sl_binary.Systems[i].Planets[j].planetSpeed) / year).ToString();
                planets[j, z++] = sl_binary.Systems[i].Planets[j].textureName;
                planets[j, z++] = sl_binary.Systems[i].Planets[j].planetName;
                planets[j, z++] = sl_binary.Systems[i].Planets[j].planetMass;
            }
            dealWithSystem_once(sol, planets, systemOffset, allCenter);
            systemOffset += oneOffset;
        }
    }
示例#22
0
        internal static List <string> GetSystemNames()
        {
            // Create a hashset so we can add things to it without worrying about duplicates
            // Added the string comparer to avoid case sensitive mismatching - Chandler
            HashSet <string> names = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            //  add all systems names since we cannot have dups
            SystemList.ForEach(s => names.Add(s.Name));

            // Return it as a sorted list, because it's easier to work with
            // Convert HashSet to List
            var output = names.ToList();

            // Order the list
            output.Sort();
            //return the list
            return(output);
        }
        public void SaveSkills(int Id, string Value, string Description, string SkillType, int UserId)
        {
            int skillTypeId = 0;

            if (SkillType == "Technical")
            {
                SystemList systemName = _otherSettingMethod.getSystemListByName("Technical Skills");
                skillTypeId = systemName.Id;
            }
            else
            {
                SystemList systemName = _otherSettingMethod.getSystemListByName("General Skills");
                skillTypeId = systemName.Id;
            }

            if (Id > 0)
            {
                SystemListValue SystemListValue = _db.SystemListValues.Where(x => x.Id == Id).FirstOrDefault();
                SystemListValue.SystemListID         = skillTypeId;
                SystemListValue.Value                = Value;
                SystemListValue.Archived             = false;
                SystemListValue.UserIDCreatedBy      = UserId;
                SystemListValue.CreatedDate          = DateTime.Now;
                SystemListValue.UserIDLastModifiedBy = UserId;
                SystemListValue.LastModified         = DateTime.Now;
                SystemListValue.Description          = Description;

                _db.SaveChanges();
            }
            else
            {
                SystemListValue SystemListValue = new SystemListValue();
                SystemListValue.SystemListID         = skillTypeId;
                SystemListValue.Value                = Value;
                SystemListValue.Archived             = false;
                SystemListValue.UserIDCreatedBy      = UserId;
                SystemListValue.CreatedDate          = DateTime.Now;
                SystemListValue.UserIDLastModifiedBy = UserId;
                SystemListValue.LastModified         = DateTime.Now;
                SystemListValue.Description          = Description;
                _db.SystemListValues.Add(SystemListValue);
                _db.SaveChanges();
            }
        }
        /// <summary>
        /// 修改命令
        /// </summary>
        /// <returns></returns>
        public override void ExecuteEdit()
        {
            if (SelectedSystem != null)
            {
                Sys_Systems sys = new Sys_Systems();
                sys.ID     = SelectedSystem.ID;
                sys.Name   = SelectedSystem.Name;
                sys.Remark = SelectedSystem.Remark;


                FrmSystemSettingEdit edit = new FrmSystemSettingEdit(sys);
                edit.SaveEvent += (s) =>
                {
                    SystemList[SystemList.IndexOf(SelectedSystem)] = s;
                    SelectedSystem = s;
                };
                edit.ShowDialog();
            }
        }
示例#25
0
 public C_System this[Guid Key, DateTime CurrentDate]
 {
     get
     {
         if (CurrentDate == new DateTime())
         {
             CurrentDate = DateTime.Now;
         }
         if (SystemList != null && SystemList.Count > 0)
         {
             var system = SystemList.ToList().Find(S => S.ID == Key);
             if (system != null && (system.VersionStart > CurrentDate || system.VersionEnd < CurrentDate))
             {
                 return(C_SystemOperator.Instance.GetSystemList(CurrentDate).ToList().Find(S => S.ID == Key));
             }
             return(system);
         }
         return(null);
     }
 }
示例#26
0
        private void OpenUpdatePop(int seqNo)
        {
            try
            {
                if (!IsClicked)
                {
                    _commonFun.AlertLongText("已结束的任务不能再设置");
                    return;
                }

                Device.BeginInvokeOnMainThread(async() =>
                {
                    await PopupNavigation.PushAsync(new UpdatePopPage(SystemList.FirstOrDefault(p => p.SeqNo == seqNo)), true);
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->SystemListViewModel");
                return;
            }
        }
示例#27
0
        internal override async Task <List <GameConsole> > GetSystemsAsync()
        {//use the webclient to grab the source code of the page
            HttpWebRequest  request  = (WebRequest.Create(new Uri(URL, "roms"))) as HttpWebRequest;
            HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();

            var status = response.StatusCode;

            if (status == HttpStatusCode.OK)
            {
                Stream       receiveStream = response.GetResponseStream();
                StreamReader readStream    = null;

                if (response.CharacterSet == null)
                {
                    readStream = new StreamReader(receiveStream);
                }
                else
                {
                    readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
                }

                string page = readStream.ReadToEnd();
                // pass the source code into the html document
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(page);

                // navigate the nodes to find the game console listings
                foreach (var node in doc.DocumentNode.SelectNodes("//html/body/div/div/div/table[2]/tr/td[1]/font[1]/table/tr/td/table/tr/td/a"))
                {
                    var system = new GameConsole(node.InnerText, new Uri(URL, node.Attributes["href"].Value), this);
                    FixConsoleName(system);
                    SystemList.Add(system);
                    TriggerSystemFound(system);
                }
            }

            return(SystemList);
        }
 public AdministratorTest()
 {
     systemList = new SystemList();
     administratorPersistence = new AdministratorPersistenceHandler(systemList);
 }
示例#29
0
        public List <SystemListValue> getAllSystemValueListByKeyName(string KeyName)
        {
            SystemList systemName = getSystemListByName(KeyName);

            return(getAllSystemValueListByNameId(systemName.Id));
        }
		public SystemDisplayGTK ()
		{
			this.Build ();	//Assembles window as layed out in Designer mode

			// Fill Stars Frame
			starDataShown = new ListStore (typeof(string), typeof(string), typeof(double), typeof(double),
			                               typeof(double), typeof(double), typeof(double), typeof(double));

			foreach (Entities.StarSystem systemMember in GameState.Instance.StarSystems) {
				SystemList.AppendText (systemMember.ToString ());
			}
			Gtk.TreeModel systemModel = SystemList.Model;
			Gtk.TreeIter firstItem;
			systemModel.GetIterFirst (out firstItem);
			SystemList.SetActiveIter (firstItem);

			starView = new Gtk.TreeView (starDataShown);
			starsFrame.Add (starView);
			string[] starHeader = {
				"Name",
				"Class",
				"Radius",
				"Mass",
				"Luminosity",
				"Temperature",
				"Habitable Zone",
				"Orbital Radius (AU)"
			};
			int headerIndex = 0;
			foreach (string header in starHeader) {
				starView.AppendColumn (header, new CellRendererText (), "text", headerIndex++);
			}

			starView.HeadersVisible = true;
			starView.ExpandAll ();

			// Fill Planet list frames
			string[] planetHeader = {
				"Name",
				"Type",
				"Surface\nTemp.",
				"Surface\nGravity",
				"Atmospher\n(Earth Masses)",
				"Orbit Dist\n(Avg)",
				"Pressure",
				"Radius"
			};

			planetList = new List<ListStore>();
			planetView = new List<TreeView>();
			for (int j = 0; j < 4; j++) {
				planetList.Add( new Gtk.ListStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string),
				                                typeof(double), typeof(double), typeof(double)));

				planetView.Add( new Gtk.TreeView (planetList[j]));
				headerIndex = 0;
				foreach (string header in planetHeader) {
					planetView [j].AppendColumn (header, new CellRendererText (), "text", headerIndex++);
				}
			}

			StarA_Space.Add (planetView[0]);
			StarB_Space.Add (planetView[1]);
			StarC_Space.Add (planetView[2]);
			StarD_Space.Add (planetView[3]);

			// After Setupt iniltialize data for default system
			isSetupFinished = true;
			selectedSystem = GameState.Instance.StarSystems [0];
			setSystemType (selectedSystem.Stars.Count);
		}
示例#31
0
        private void LoadGameContent()
        {
            SplashScreen.ShowSplashScreen();
            SplashScreen.SetStatus("Initializing Roslyn");
            SkillEffect.LoadAllEffects();
            SplashScreen.SetStatus("Initializing Graphics");
            BattleMap.DicGlobalVariables = new Dictionary <string, string>();
            BattleMap.DicRouteChoices    = new Dictionary <string, int>();
            GameScreen.LoadHelpers(Content);
            TextHelper.LoadHelpers(Content);

            #region Key mapping

            FileStream   FS = new FileStream("Keys.ini", FileMode.Open, FileAccess.Read);
            StreamReader SR = new StreamReader(FS);
            string       StreamLine;
            string[]     StreamData;
            string[]     StreamKeys;
            List <Keys>  ListNewKeys = new List <Keys>();
            Keys         NewKey;
            Keys[]       UsedKeys;

            while (!SR.EndOfStream)
            {
                StreamLine = SR.ReadLine();
                ListNewKeys.Clear();

                if (StreamLine.Contains('='))
                {
                    StreamData = StreamLine.Split('=');
                    StreamKeys = StreamData[1].Split(',');

                    //Read keys
                    for (int K = 0; K < StreamKeys.Length; K++)
                    {
                        NewKey = ConvertTextToKeys(StreamKeys[K].Trim());
                        if (!ListNewKeys.Contains(NewKey))
                        {
                            ListNewKeys.Add(NewKey);
                        }
                    }
                    UsedKeys = ListNewKeys.ToArray();

                    //Assign keys to the right command.
                    switch (StreamData[0].Trim())
                    {
                    case "Left":
                        KeyboardHelper.MoveLeft = UsedKeys;
                        break;

                    case "Right":
                        KeyboardHelper.MoveRight = UsedKeys;
                        break;

                    case "Up":
                        KeyboardHelper.MoveUp = UsedKeys;
                        break;

                    case "Down":
                        KeyboardHelper.MoveDown = UsedKeys;
                        break;

                    case "Confirm":
                        KeyboardHelper.ConfirmChoice = UsedKeys;
                        break;

                    case "Cancel":
                        KeyboardHelper.CancelChoice = UsedKeys;
                        break;

                    case "Command 1":
                        KeyboardHelper.Command1 = UsedKeys;
                        break;

                    case "Command 2":
                        KeyboardHelper.Command2 = UsedKeys;
                        break;

                    case "L Button":
                        KeyboardHelper.LButton = UsedKeys;
                        break;

                    case "R Button":
                        KeyboardHelper.RButton = UsedKeys;
                        break;

                    case "Skip":
                        KeyboardHelper.Skip = UsedKeys;
                        break;
                    }
                }
            }

            FS.Close();
            SR.Close();

            #endregion

            SplashScreen.SetStatus("Loading Ressources");

            SystemList.LoadSystemLists();

            #region Ressources loading

            string[] Files;
            bool     InstanceIsBaseObject;
            Type     ObjectType;

            #region Battle Maps

            Files = Directory.GetFiles("Mods", "*.dll");
            for (int F = 0; F < Files.Length; F++)
            {
                Assembly ass = Assembly.LoadFile(Path.GetFullPath(Files[F]));
                //Get every classes in it.
                Type[] types = ass.GetTypes();
                for (int t = 0; t < types.Count(); t++)
                {
                    //Look if the class inherit from Unit somewhere.
                    ObjectType           = types[t].BaseType;
                    InstanceIsBaseObject = ObjectType == typeof(BattleMap);
                    while (ObjectType != null && ObjectType != typeof(BattleMap))
                    {
                        ObjectType = ObjectType.BaseType;
                        if (ObjectType == null)
                        {
                            InstanceIsBaseObject = false;
                        }
                    }
                    //If this class is from BaseEditor, load it.
                    if (InstanceIsBaseObject)
                    {
                        BattleMap instance = Activator.CreateInstance(types[t]) as BattleMap;
                        BattleMap.DicBattmeMapType.Add(instance.GetMapType(), instance);
                    }
                }
            }

            #endregion

            #endregion

            SplashScreen.CloseForm();
        }
示例#32
0
 private void Init(string username, string password)
 {
     systemList = new SystemList(username, password);
     InitSystemList ();
     foreach (int port in portBlock) localPorts.Add (port, false);
 }