/// <summary> /// 管理员管理操作 /// </summary> protected void Submit1_ServerClick(object sender, EventArgs e) { string AllDelItems; AllDelItems = this.Request.Form["Pid"]; if (AllDelItems != null) { string[] arr = AllDelItems.Split(','); foreach (var item in arr) { int resultID = 0; bool isSucess = false; if (!string.IsNullOrEmpty(item)) { isSucess = int.TryParse(item, out resultID); } if (isSucess) { if (SiteManagement.DeleteUser(resultID)) { } else { this.Response.Write(BaseSystem.ShowWindow("出现异常,对不起,删除管理员操作失败!!")); break; } } } this.Response.Redirect("AdminManage.aspx"); } else { this.Response.Write(BaseSystem.ShowWindow("信息提示:请先选择要删除的医院!!")); } }
/// <summary> /// Converts a positive number from any base system to Decimal. /// </summary> /// <param name="number">Digits should be ordered in the array from most to least significant. 724 would be [ 7, 2, 4]</param> /// <returns>True if conversion was successful</returns> /// <remarks>This function can support any base system supported by <see cref="BaseSystem"/>, we assume that all Base systems above decimal make use of A-F characters</remarks> public static bool BaseToDecimal(string number, BaseSystem frombase, out int convertedValue) { convertedValue = 0; // Reverse for ease of calculation, index corresponds to digit position in number char[] splitNumber = number.ToCharArray(); Array.Reverse(splitNumber); // Confirm that we won't immediately overflow the int int mostSignificantDigit = Parse(splitNumber[splitNumber.Length - 1], frombase); int largestSupportedIndex = (int)(Math.Log10(int.MaxValue / mostSignificantDigit) / Math.Log10((int)frombase)); if (splitNumber.Length - 1 > largestSupportedIndex) { return(false); } // Digit x Base ^ Index = DecimalOfDigit for (int i = splitNumber.Length - 1; i >= 0; i--) { // WHAT about overflowing an int for large numbers? int decimalNumber = Parse(splitNumber[i], frombase) * (int)Math.Pow((int)frombase, i); if (decimalNumber > int.MaxValue - convertedValue) { return(false); } convertedValue += decimalNumber; } return(true); }
/// <summary> /// 添加新新医院事件 /// </summary> protected void Submit1_ServerClick(object sender, EventArgs e) { if (this.Region.SelectedIndex == 0) { this.Response.Write(BaseSystem.ShowWindow("信息提示:请选择医院所在地区!!")); return; } string hospitalname = Request.Form["hospitalname"].Trim(); string comment = Request.Form["comment"].Trim(); string message = string.Empty; bool isSuccess = SiteManagement.CreateHospital(hospitalname, this.Region.Text, comment, out message); if (!isSuccess) { if (!string.IsNullOrEmpty(message)) { this.Response.Write(BaseSystem.ShowWindow(message)); } else { this.Response.Write(BaseSystem.ShowWindow("信息提示:医院已经添加!!")); } } else { this.Response.Write(BaseSystem.ShowWindow("信息提示:医院添加成功!!")); } }
/// <summary> /// 添加新管理员事件 /// </summary> protected void Submit1_ServerClick(object sender, EventArgs e) { string userName = Request.Form["username"].Trim(); string password = Request.Form["newpass"].Trim(); int hospitalID = 0; bool isSucess = int.TryParse(this.SelectHosptial.SelectedValue, out hospitalID); if (isSucess) { string message = string.Empty; bool isSuccess = SiteManagement.CreateUser(userName, password, hospitalID, 2, ref message); if (!isSuccess) { if (!string.IsNullOrEmpty(message)) { this.Response.Write(BaseSystem.ShowWindow(message)); } else { this.Response.Write(BaseSystem.ShowWindow("抱歉,此用户已经存在数据库中!!")); } } else { this.Response.Write(BaseSystem.ShowWindow("管理员添加成功!!")); } } }
/// <summary> /// Takes a number represented as an array of digits and converts it from one Base system to another. /// </summary> /// <param name="number">Digits should be ordered in the array from most to least significant. 724 would be [ 7, 2, 4] </param> /// <remarks>This function can support any base system supported by <see cref="BaseSystem"/>, we assume that all Base systems above decimal make use of A-F characters</remarks> public static string ConvertBase(string number, BaseSystem frombase, BaseSystem toBase) { string convertedValue = ""; int decimalValue; char firstCharacter = number[0]; bool isNegative = firstCharacter.Equals('-'); if (isNegative) { number = number.Remove(0, 1); } if (BaseToDecimal(number, frombase, out decimalValue)) { DecimalToBase(decimalValue, toBase, ref convertedValue); } if (isNegative) { convertedValue = string.Format("-{0}", convertedValue); } return(convertedValue); }
/// <summary> /// 管理员密码管理 /// </summary> protected void Submit1_SavePassword_ServerClick(object sender, EventArgs e) { // 获取当前管理员的用户名和密码 if (Session["sa"] != null) { // string userName = Session["admin"].ToString(); string userName = Session["sa"].ToString(); string passWord = this.Request.Form["oldpass"].Trim(); string newPassWord = this.Request.Form["newpass"].Trim(); // 检验原密码是否正确 if (SiteManagement.IsLogon(userName, passWord)) { // 开始修改管理员的密码 if (SiteManagement.UpdateUserPassword(userName, newPassWord)) { this.Response.Write(BaseSystem.ShowWindow("密码修改成功!!")); } else { this.Response.Write(BaseSystem.ShowWindow("出现异常错误,密码修改失败!!")); } } else { this.Response.Write(BaseSystem.ShowWindow("对不起,你的原密码不正确!!")); } } else { this.Response.Write("登录已超时!!"); } }
// Start is called before the first frame update void Start() { if (!(shipEntity = FindObjectOfType <ShipEntity>())) { Debug.Log(this.GetType().Name + " have not found " + typeof(ShipEntity)); } if (!(baseSystem = FindObjectOfType <BaseSystem>())) { Debug.Log(this.GetType().Name + " have not found " + typeof(BaseSystem)); } if (!(timerManager = FindObjectOfType <TimerManager>())) { Debug.Log(this.GetType().Name + " have not found " + typeof(TimerManager)); } if (shipEntity != null) { shipTransform = shipEntity.GetComponent <Transform>(); } if (baseSystem != null) { baseTransform = baseSystem.GetComponent <Transform>(); } healthPointSlider.maxValue = shipEntity.MaximalHealth; eachNitroPointRate = (1.0f - (coverNitroPointRate * 2.0f)) / shipEntity.MaximalNitro; nitroPointImage.fillAmount = (eachNitroPointRate * shipEntity.MaximalNitro) + coverNitroPointRate; weightPointSlider.maxValue = shipEntity.MaximalWeight; }
private BaseSystem InitSystem(OperationObject operationObject, ECSDefine.SystemType systemType, int systemId) { BaseSystem system = operationObject as BaseSystem; system.SetSystemId(systemId); system.SetSystemType(systemType); ECSDefine.SystemPriority systemPriority; if (!ECSInstanceDefine.SystemType2Priority.TryGetValue(systemType, out systemPriority)) { Debug.LogError($"[ECSModule] GetSystemType2Priority Fail. No Reocrd. systemType:{Enum.GetName(typeof(ECSDefine.SystemType), systemType)}"); systemPriority = ECSDefine.SystemPriority.Normal; } system.SetSystemPriority(systemPriority); ECSDefine.SystemFunctionType systemFunctionType; if (!ECSInstanceDefine.SystemType2Function.TryGetValue(systemType, out systemFunctionType)) { Debug.LogError($"[ECSModule] SystemType2Function Fail. No Reocrd. systemType:{Enum.GetName(typeof(ECSDefine.SystemType), systemType)}"); systemFunctionType = ECSDefine.SystemFunctionType.Logic; } system.SetSystemFunctionType(systemFunctionType); system.FillInComponentInfo(); return(system); }
public void ExecuteSystem(int entityId, ECSDefine.SystemType systemType, BaseSystem.SystemExpandData expandData) { BaseEntity entity = ECSUnit.GetEntity(entityId); if (entity == null) { Debug.LogError($"[ECSModule] ExecuteSystem Fail. Entity Is nil. entityId:{entityId}"); return; } int systemId = systemIdDistributionChunk.Pop(); BaseSystem system = CreateImmediatelyExecuteSystem(systemType, systemId); if (system == null) { return; } do { if (system.GetSystemFunctionType() != ECSDefine.SystemFunctionType.Logic) { Debug.LogError($"[ECSModule] ExecuteSystem Fail. Only Can ImmediatelyExecute Logic Type. entityId:{entityId} systemType:{Enum.GetName(typeof(ECSDefine.SystemType), systemType)}"); break; } system.SetGlobalUnionId(GlobalUnionId); system.Execute(entityId, expandData); }while (false); DeleteImmediatelyExecuteSystem(system);//执行完毕回收 }
// Start is called before the first frame update void Start() { //HideDamageIndicator(); VFX_Drill(false); VFX_Thrust(false); VFX_Healing(false); shipEntity = GetComponent <ShipEntity>(); skillTree = GetComponent <SkillTree>(); baseSystem = FindObjectOfType <BaseSystem>(); inGameMenuManager = FindObjectOfType <InGameMenuManager>(); playerCollision = GetComponent <BoxCollider>(); playerRigidbody = GetComponent <Rigidbody>(); playerTransform = GetComponent <Transform>(); basePosition = FindObjectOfType <BaseSystem>().transform.position; //slowDrillToggle.isOn = (drillSpeed == DrillSpeed.slow) ? true : false; //drillerVibrationFrequencyParticleSystem.Stop(); eachWeightAffectThrustRate = (thrustPower - minimalThrustPower) / shipEntity.MaximalWeight; ControlThrustPowerByWeightRate(); // The thrust power will follow current weight rate //heatAmount = GetComponent<HeatSystem>().getHeatAmount(); //maxHeatAmount = GetComponent<HeatSystem>().getMaxHeatAmount(); originalDragRate = playerRigidbody.drag; }
/// <summary> /// /// </summary> protected void Submit1_ServerClick(object sender, EventArgs e) { // 获取当前管理员的用户名和密码 if (Session["admin"] != null) { string userName = Session["admin"].ToString(); string passWord = this.Request.Form["oldpass"].Trim(); string newPassWord = this.Request.Form["newpass"].Trim(); // 检验原密码是否正确 if (SiteManagement.IsLogon(userName, passWord)) { // 开始修改管理员的密码 // string sql = "update admin set [password]='" + FormsAuthentication.HashPasswordForStoringInConfigFile(NewPassWord, "MD5").ToLower().Substring(8, 16) + "' where username='******'"; if (SiteManagement.UpdateUserPassword(userName, newPassWord)) { this.Response.Write(BaseSystem.ShowWindow("密码修改成功!!")); } else { this.Response.Write(BaseSystem.ShowWindow("出现异常错误,密码修改失败!!")); } } else { this.Response.Write(BaseSystem.ShowWindow("对不起,你的原密码不正确!!")); } } else { this.Response.Write("登录已超时!!"); } }
/// <summary> /// 添加新用户事件 /// </summary> protected void Submit1_ServerClick(object sender, EventArgs e) { string userName = Request.Form["username"].Trim(); string password = Request.Form["newpass"].Trim(); userAdmin = (SiteUser)Session["admin"]; string message = string.Empty; if (userAdmin != null) { bool isSuccess = SiteManagement.CreateUser(userName, password, userAdmin.Hospital.ID, 3, ref message); if (!isSuccess) { if (!string.IsNullOrEmpty(message)) { this.Response.Write(BaseSystem.ShowWindow(message)); } else { this.Response.Write(BaseSystem.ShowWindow("抱歉,此用户已经存在数据库中!!")); } } else { this.Response.Write(BaseSystem.ShowWindow("新用户添加成功!!")); } } }
public void RegFixedUpdateSystem(BaseSystem system) { if (systemFixedUpdateList.Contains(system)) { return; } systemFixedUpdateList.Add(system); }
public TourForm(BaseSystem baseSystem) { this.baseSystem = baseSystem; aboutTour = new AboutTour(baseSystem); aboutLocality = new AboutLocality(baseSystem); InitializeComponent(); UpdateForm(); }
public void AddSystemListener(Type type, BaseSystem s) { List <BaseSystem> systems = SystemsForType(type); if (s != null && !systems.Contains(s)) { systems.Add(s); } }
public void RemoveSystemListener(Type type, BaseSystem s) { List <BaseSystem> systems = SystemsForType(type); if (s != null && systems.Contains(s)) { systems.Remove(s); } }
// Start is called before the first frame update void Start() { enemySpawner.generate(); baseSystem = FindObjectOfType <BaseSystem>(); endScoreUpdating = FindObjectOfType <EndScoreUpdating>(); timerManager = FindObjectOfType <TimerManager>(); }
public void RegisterSystem(BaseSystem system) { if (Systems.Contains(system)) { System.Diagnostics.Debug.WriteLine($"System of type {system.GetType()} already registered."); } else { Systems.Add(system); } }
public void RemoveSystem(BaseSystem system) { if (Systems.Contains(system)) { Systems.Remove(system); } else { System.Diagnostics.Debug.WriteLine($"System of type {system.GetType()} not registered."); } }
/// <summary> /// Deliver message to all family from top system. /// </summary> public virtual void PostMessage(BaseSystem sender, int msg, object arg1 = null, object arg2 = null) { var cur = this; while (cur.parent != null) { cur = cur.parent; } cur.OnMessage(sender, msg, arg1, arg2); }
public TechnologistForm(BaseSystem baseSystem) { this.baseSystem = baseSystem; callSimulation = new CallSimulation(baseSystem); clientInfoForm = new ClientInfoForm(); replenishmentSimulation = new ReplenishmentSimulation(baseSystem); debtorsForm = new DebtorsForm(baseSystem); statisticMonthForm = new StatisticMonthForm(baseSystem); currentTimeSimulation = new CurrentTimeSimulation(); getPriceByDateForm = new GetPriceByDateForm(baseSystem); InitializeComponent(); UpdateForm(); }
protected BaseMainWindow(int width, int height) : base(null) { fPrevPos = new ExtPoint(); fFrameCount = 0; fFrameStartTime = 0; FPS = 0f; fSystem = new SDL2System(this, width, height, false); Bounds = ExtRect.Create(0, 0, width - 1, height - 1); fHintWindow = CreateHintWindow(this); }
//注册系统 private void RegSystems() { List <Type> systemTypes = LCReflect.GetClassByType <BaseSystem>(); List <Type> updateSystems = new List <Type>(); List <Type> fixedUpdateSystems = new List <Type>(); //分组 for (int i = 0; i < systemTypes.Count; i++) { Type type = systemTypes[i]; SystemAttribute attr = LCReflect.GetTypeAttr <SystemAttribute>(type); if (attr == null) { //ECSLocate.ECSLog.Log("该系统没有设置系统特性>>>>>>", type.Name); updateSystems.Add(type); } else { if (attr.InFixedUpdate) { fixedUpdateSystems.Add(type); } else { updateSystems.Add(type); } } } //排序 updateSystems.Sort(SystemSortFunc); fixedUpdateSystems.Sort(SystemSortFunc); //注册 for (int i = 0; i < updateSystems.Count; i++) { Type type = updateSystems[i]; BaseSystem system = LCReflect.CreateInstanceByType <BaseSystem>(type.FullName); system.Init(); ECSLocate.ECS.RegUpdateSystem(system); } for (int i = 0; i < fixedUpdateSystems.Count; i++) { Type type = fixedUpdateSystems[i]; BaseSystem system = LCReflect.CreateInstanceByType <BaseSystem>(type.FullName); system.Init(); ECSLocate.ECS.RegFixedUpdateSystem(system); } }
/// <summary> /// 清除用户登陆信息 /// </summary> protected void Clear_Click(object sender, EventArgs e) { DeleteBLO deleteBLO = new DeleteBLO(); if (deleteBLO.ClearLogs()) { this.DataListUserLog.DataSource = null; DataListUserLog.DataBind(); } else { this.Response.Write(BaseSystem.ShowWindow("出现异常,对不起,清空日志操作失败!!")); } }
/// <summary> /// Recurcively converts a positive number from decimal to another base system /// </summary> /// <param name="number">The number to convert</param> /// <param name="toBase">The base system to convert it to</param> /// <param name="convertedValue">The converted value</param> /// <remarks>This function can support any base system supported by <see cref="BaseSystem"/>, we assume that all Base systems above decimal make use of A-F characters</remarks> public static void DecimalToBase(int number, BaseSystem toBase, ref string convertedValue) { number = Math.Abs(number); if (number < (int)toBase) { convertedValue += ConvertToBaseString(number, toBase); return; } int remainder = number % (int)toBase; DecimalToBase((number - remainder) / (int)toBase, toBase, ref convertedValue); convertedValue += ConvertToBaseString(remainder, toBase); }
/// <summary> /// 提交用户密码修改 /// </summary> protected void Submit1_ServerClick(object sender, EventArgs e) { string username = Request.Form["username"].Trim(); string password = Request.Form["newpass"].Trim(); // Modify user's password if (SiteManagement.UpdateUserPassword(username, password)) { this.Response.Write(BaseSystem.ShowWindow("修改普通用户密码成功!!")); } else { this.Response.Write(BaseSystem.ShowWindow("出现异常错误,修改普通用户失败!!")); } }
/// <summary> /// Deliver message to all children children of this system. Do not deliver to self. /// </summary> public virtual void OnMessage(BaseSystem sender, int msg, object arg1, object arg2) { if (sender == this) { return; } if (children != null) { var cur = children; do { cur.OnMessage(sender, msg, arg1, arg2); } while ((cur = cur.sibling) != null); } }
void Start() { for (int i = 0; i < (int)Global.OresTypes.Length; i++) { oresAmount.Add((Global.OresTypes)i, 0.0f); // Set up all kind of ores type to |*|oresAmount|*| } //Debug.Log(oresAmount.Count); if (!(baseSystem = FindObjectOfType <BaseSystem>())) { Debug.Log("BaseSystem are missing!!!"); } // !!! For Testing //oresAmount[Global.OresTypes.Iron] = 100.0f; //oresAmount[Global.OresTypes.no2_Ores] = 300.0f; }
/// <summary> /// 医院信息修改 /// </summary> protected void Submit1_ServerClick(object sender, EventArgs e) { this.GetHospitalName(); string hospitalname = Request.Form["hospitalname"].Trim(); string comment = Request.Form["comment"].Trim(); if (string.IsNullOrEmpty(hospitalname)) { this.Response.Write(BaseSystem.ShowWindow("医院名称不能为空!!")); } if (string.IsNullOrEmpty(comment)) { this.Response.Write(BaseSystem.ShowWindow("注释不能为空!!")); } if (hospitalNameOriginal.Equals(hospitalname)) { this.Response.Write(BaseSystem.ShowWindow("请换一个名字,当前的医院名称已经存在!!")); return; } string id = this.Request.QueryString["ID"]; if (!string.IsNullOrEmpty(id)) { bool isSucess = uint.TryParse(id, out hospitalID); } // 修改医院具体信息 string message = string.Empty; bool isSuccess = SiteManagement.UpdateHospital(hospitalID, hospitalname, comment, out message); if (!isSuccess) { if (!string.IsNullOrEmpty(message)) { this.Response.Write(BaseSystem.ShowWindow(message)); } } else { this.Response.Write(BaseSystem.ShowWindow("医院修改成功!!")); this.Response.Redirect("AdminManageHospital.aspx"); } }
/// <summary><para>Die statische Methode prüft, ob die Koordinaten des übergebenen <see cref="BaseSystem"/>-Objekts /// in also in Deutschland liegen. Das Gauss-Krüger Koordinatensystem ist nur für Deutschland definiert.</para></summary> /// <param name="system">Ein gültiges Objekt einer von <see cref="BaseSystem"/> abgeleiteten Klasse.</param> /// <returns>True, wenn die Koordinaten in Deutschland liegen, sonst False.</returns> public static bool ValidRange(BaseSystem system) { bool result = false; try { Geographic geo = null; if (system == null) { return(false); } else if (system.GetType() == typeof(Geographic)) { geo = (Geographic)system; } else if (system.GetType() == typeof(UTM)) { geo = (Geographic)(UTM)system; } else if (system.GetType() == typeof(MGRS)) { geo = (Geographic)(MGRS)system; } else if (system.GetType() == typeof(GaussKrueger)) { return(true); } if (geo == null) { return(false); } if ((geo.Longitude < 5.0) || (geo.Longitude > 16.0) || (geo.Latitude < 46.0) || (geo.Latitude > 56.0)) { result = false; } else { result = true; } } catch (Exception) { } return(result); }
public SystemWrapper(BaseSystem system) { System = system; entities = new List<Entity>(); }
private void Setup() { systemO = new EmptySystem(); systemA = new SystemA(); systemB = new SystemB(); systemBC = new SystemBC(); world = CreateWorld(systemO, systemA, systemB, systemBC); info = world.DebugInfo; }
public int EntityCount(BaseSystem system) { return systems.GetEntityCount(system); }
public void TestSystemAddedAfterEntity() { world = CreateWorld(); info = world.DebugInfo; AddComponents(world.CreateEntity(), new ComponentA()); AddComponents(world.CreateEntity(), new ComponentB()); AddComponents(world.CreateEntity(), new ComponentB(), new ComponentC()); systemO = new EmptySystem(); systemA = new SystemA(); systemB = new SystemB(); systemBC = new SystemBC(); world.AddSystem(systemO); world.AddSystem(systemA); world.AddSystem(systemB); world.AddSystem(systemBC); AddComponents(world.CreateEntity(), new ComponentA()); Assert.AreEqual(4, info.EntityCount(systemO)); Assert.AreEqual(2, info.EntityCount(systemA)); Assert.AreEqual(2, info.EntityCount(systemB)); Assert.AreEqual(1, info.EntityCount(systemBC)); }