private void btnOk_Click(object sender, EventArgs e) { GridSys.EndEdit(); if (DataFrmToClass(this, out cMain.mSysSet)) { if (DataClassToFile(cMain.mSysSet)) { MessageBox.Show("数据保存成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } MessageBox.Show("数据保存失败,请检查数据输入是否有效", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); }
// Use this for initialization void Awake() { //var color = gameObject.GetComponent<Renderer>().material.color; //var newColor = new Color(color.r, color.g, color.b, 0.5f); //gameObject.GetComponent<Renderer>().material.color = newColor; if (grid == null) { grid = FindObjectOfType <GridSys>(); } if (playerShip == null) { playerShip = FindObjectOfType <ShipBlockList>(); } myMesh = gameObject.GetComponent <MeshRenderer>(); //myMesh.enabled = false; myMesh.material.color = new Color(myMesh.material.color.r, myMesh.material.color.g, myMesh.material.color.b, defaultOpacity); //isPartOfShip = false; hashCode = GetHashCode(); }
protected override void OnUpdate() { float currentFrameTime = UnityEngine.Time.smoothDeltaTime * 1000f; //Smoothed unavailable in DOTS var totalEnemyCount = SoldierSpawner.NumSoldiersPerTeam + GridSys.addedEnemies.Count; enemyCountGUI.text = "Enemy Count: " + totalEnemyCount; targetFPSGUI.text = "Targeting: " + targetFrameRate + " FPS @ " + targetFrameTime + "ms per frame \nSmoothed reporting " + currentFrameTime.ToString("F3") + "ms"; enemyPerMSGUI.text = "Each enemy approx " + (currentFrameTime / totalEnemyCount).ToString("F5") + "ms"; Debug.Log("updating UI"); if (targetFrameTime > currentFrameTime) //Frame is taking shorter than requested, spawn more guys { GridSys.AddEnemyToGridLate(5); } else if (targetFrameTime < currentFrameTime) //Frame is taking longer than desired, remove a lad { GridSys.RemoveEnemyFromGridLate(); } }