You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
295 lines
13 KiB
295 lines
13 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class DataCenter : Singleton<DataCenter>
|
|
{
|
|
public bool isStart = false;
|
|
public GameObject canvas;
|
|
public GameState curstate;
|
|
public Text type_sm_number;
|
|
public Text type_qc_number;
|
|
public Text type_cm_number;
|
|
public Text type_sm_scale;
|
|
public Text type_qc_scale;
|
|
public Text type_cm_scale;
|
|
|
|
public Text distribute_A_number;
|
|
public Text distribute_B_number;
|
|
public Text distribute_C_number;
|
|
public Text distribute_D_number;
|
|
public Image distribute_A_scale;
|
|
public Image distribute_B_scale;
|
|
public Image distribute_C_scale;
|
|
public Image distribute_D_scale;
|
|
|
|
public Text proportion_td_number;
|
|
public Text proportion_sm_number;
|
|
public Text proportion_qc_number;
|
|
public Text proportion_cm_number;
|
|
public Text proportion_dy_number;
|
|
public Text proportion_hlb_number;
|
|
|
|
public Image proportion_td_scale;
|
|
public Image proportion_sm_scale;
|
|
public Image proportion_qc_scale;
|
|
public Image proportion_cm_scale;
|
|
public Image proportion_dy_scale;
|
|
public Image proportion_hlb_scale;
|
|
|
|
int min_maturity=20;
|
|
int max_maturity=90;
|
|
float speed=5;
|
|
float time1=0;
|
|
|
|
int DP1_sm_number=100;
|
|
int DP1_qc_number=200;
|
|
int DP1_cm_number=300;
|
|
int DP1_sm_maturity=50;
|
|
int DP1_qc_maturity=60;
|
|
int DP1_cm_maturity=70;
|
|
|
|
int DP2_sm_number=150;
|
|
int DP2_qc_number=250;
|
|
int DP2_cm_number=350;
|
|
int DP2_sm_maturity=55;
|
|
int DP2_qc_maturity=65;
|
|
int DP2_cm_maturity=75;
|
|
|
|
int DP3_sm_number=160;
|
|
int DP3_qc_number=260;
|
|
int DP3_cm_number=360;
|
|
int DP3_sm_maturity=56;
|
|
int DP3_qc_maturity=66;
|
|
int DP3_cm_maturity=76;
|
|
|
|
int DP1_area1_number=789;
|
|
int DP1_area2_number=456;
|
|
int DP1_area3_number=123;
|
|
int DP1_area4_number=147;
|
|
|
|
int DP2_area1_number=258;
|
|
int DP2_area2_number=369;
|
|
int DP2_area3_number=159;
|
|
int DP2_area4_number=357;
|
|
|
|
int DP3_area1_number=785;
|
|
int DP3_area2_number=325;
|
|
int DP3_area3_number=145;
|
|
int DP3_area4_number=965;
|
|
|
|
|
|
int DP_1_number;
|
|
//float DP1_area1_scale;
|
|
//float DP1_area2_scale;
|
|
//float DP1_area3_scale;
|
|
//float DP1_area4_scale;
|
|
|
|
int DP_2_number;
|
|
//float DP2_area1_scale;
|
|
//float DP2_area2_scale;
|
|
//float DP2_area3_scale;
|
|
//float DP2_area4_scale;
|
|
|
|
int DP_3_number;
|
|
//float DP3_area1_scale;
|
|
//float DP3_area2_scale;
|
|
//float DP3_area3_scale;
|
|
//float DP3_area4_scale;
|
|
|
|
int DP1_output;
|
|
int DP1_td_output=123;
|
|
int DP1_sm_output=456;
|
|
int DP1_qc_output=589;
|
|
int DP1_cm_output=147;
|
|
int DP1_dy_output=258;
|
|
int DP1_hlb_output=369;
|
|
|
|
int DP2_output;
|
|
int DP2_td_output=321;
|
|
int DP2_sm_output=654;
|
|
int DP2_qc_output=987;
|
|
int DP2_cm_output=741;
|
|
int DP2_dy_output=852;
|
|
int DP2_hlb_output=963;
|
|
|
|
int DP3_output;
|
|
int DP3_td_output=753;
|
|
int DP3_sm_output=357;
|
|
int DP3_qc_output=951;
|
|
int DP3_cm_output=159;
|
|
int DP3_dy_output=802;
|
|
int DP3_hlb_output=759;
|
|
|
|
//int DP1_td_output_scale;
|
|
//int DP1_sm_output_scale;
|
|
//int DP1_qc_output_scale;
|
|
//int DP1_cm_output_scale;
|
|
//int DP1_dy_output_scale;
|
|
//int DP1_hlb_output_scale;
|
|
|
|
//int DP2_td_output_scale;
|
|
//int DP2_sm_output_scale;
|
|
//int DP2_qc_output_scale;
|
|
//int DP2_cm_output_scale;
|
|
//int DP2_dy_output_scale;
|
|
//int DP2_hlb_output_scale;
|
|
|
|
//int DP3_td_output_scale;
|
|
//int DP3_sm_output_scale;
|
|
//int DP3_qc_output_scale;
|
|
//int DP3_cm_output_scale;
|
|
//int DP3_dy_output_scale;
|
|
//int DP3_hlb_output_scale;
|
|
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
DP_1_number = DP1_area1_number + DP1_area2_number + DP1_area3_number + DP1_area4_number;
|
|
DP_2_number = DP2_area1_number + DP2_area2_number + DP2_area3_number + DP2_area4_number;
|
|
DP_3_number = DP3_area1_number + DP3_area2_number + DP3_area3_number + DP3_area4_number;
|
|
DP1_output = DP1_td_output + DP1_sm_output + DP1_qc_output + DP1_cm_output + DP1_dy_output + DP1_hlb_output;
|
|
DP2_output = DP2_td_output + DP2_sm_output + DP2_qc_output + DP2_cm_output + DP2_dy_output + DP2_hlb_output;
|
|
DP3_output = DP3_td_output + DP3_sm_output + DP3_qc_output + DP3_cm_output + DP3_dy_output + DP3_hlb_output;
|
|
}
|
|
private void Update()
|
|
{
|
|
if (!canvas.activeInHierarchy) return;
|
|
switch (GameManager.Instance.curState)
|
|
{
|
|
case GameState.Vertical:
|
|
|
|
break;
|
|
case GameState.DPUpper:
|
|
time1 += Time.deltaTime;
|
|
if (time1>=speed) {
|
|
time1 = 0;
|
|
DP1_sm_maturity++;
|
|
DP1_qc_maturity++;
|
|
DP1_cm_maturity++;
|
|
if (DP1_sm_maturity > max_maturity) DP1_sm_maturity = min_maturity;
|
|
if (DP1_qc_maturity > max_maturity) DP1_sm_maturity = min_maturity;
|
|
if (DP1_cm_maturity > max_maturity) DP1_sm_maturity = min_maturity;
|
|
}
|
|
type_sm_number.text = DP1_sm_number.ToString();
|
|
type_qc_number.text = DP1_qc_number.ToString();
|
|
type_cm_number.text= DP1_cm_number.ToString();
|
|
type_sm_scale.text= DP1_sm_maturity.ToString();
|
|
type_qc_scale.text= DP1_qc_maturity.ToString();
|
|
type_cm_scale.text= DP1_cm_maturity.ToString();
|
|
|
|
distribute_A_number.text= DP1_area1_number.ToString();
|
|
distribute_B_number.text= DP1_area2_number.ToString();
|
|
distribute_C_number.text= DP1_area3_number.ToString();
|
|
distribute_D_number.text= DP1_area4_number.ToString();
|
|
distribute_A_scale.fillAmount= (float)DP1_area1_number /DP_1_number;
|
|
distribute_B_scale.fillAmount= (float)DP1_area2_number / DP_1_number;
|
|
distribute_C_scale.fillAmount= (float)DP1_area3_number / DP_1_number;
|
|
distribute_D_scale.fillAmount= (float)DP1_area4_number / DP_1_number;
|
|
|
|
proportion_td_number.text= DP1_td_output.ToString();
|
|
proportion_sm_number.text = DP1_sm_output.ToString();
|
|
proportion_qc_number.text = DP1_qc_output.ToString();
|
|
proportion_cm_number.text = DP1_cm_output.ToString();
|
|
proportion_dy_number.text = DP1_dy_output.ToString();
|
|
proportion_hlb_number.text = DP1_hlb_output.ToString();
|
|
proportion_td_scale.transform.localScale = 2 * new Vector3(1,1,1)*(float)DP1_td_output / DP1_output;
|
|
proportion_sm_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP1_sm_output / DP1_output;
|
|
proportion_qc_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP1_qc_output / DP1_output;
|
|
proportion_cm_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP1_cm_output / DP1_output;
|
|
proportion_dy_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP1_dy_output / DP1_output;
|
|
proportion_hlb_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP1_hlb_output / DP1_output ;
|
|
break;
|
|
case GameState.DPMiddle:
|
|
time1 += Time.deltaTime;
|
|
if (time1 >= speed)
|
|
{
|
|
time1 = 0;
|
|
DP2_sm_maturity++;
|
|
DP2_qc_maturity++;
|
|
DP2_cm_maturity++;
|
|
if (DP2_sm_maturity > max_maturity) DP2_sm_maturity = min_maturity;
|
|
if (DP2_qc_maturity > max_maturity) DP2_qc_maturity = min_maturity;
|
|
if (DP2_cm_maturity > max_maturity) DP2_cm_maturity = min_maturity;
|
|
}
|
|
type_sm_number.text = DP2_sm_number.ToString();
|
|
type_qc_number.text = DP2_qc_number.ToString();
|
|
type_cm_number.text = DP2_cm_number.ToString();
|
|
type_sm_scale.text = DP2_sm_maturity.ToString();
|
|
type_qc_scale.text = DP2_qc_maturity.ToString();
|
|
type_cm_scale.text = DP2_cm_maturity.ToString();
|
|
|
|
distribute_A_number.text = DP2_area1_number.ToString();
|
|
distribute_B_number.text = DP2_area2_number.ToString();
|
|
distribute_C_number.text = DP2_area3_number.ToString();
|
|
distribute_D_number.text = DP2_area4_number.ToString();
|
|
distribute_A_scale.fillAmount = (float)DP2_area1_number / DP_2_number;
|
|
distribute_B_scale.fillAmount = (float)DP2_area2_number / DP_2_number;
|
|
distribute_C_scale.fillAmount = (float)DP2_area3_number / DP_2_number;
|
|
distribute_D_scale.fillAmount = (float)DP2_area4_number / DP_2_number;
|
|
|
|
proportion_td_number.text = DP2_td_output.ToString();
|
|
proportion_sm_number.text = DP2_sm_output.ToString();
|
|
proportion_qc_number.text = DP2_qc_output.ToString();
|
|
proportion_cm_number.text = DP2_cm_output.ToString();
|
|
proportion_dy_number.text = DP2_dy_output.ToString();
|
|
proportion_hlb_number.text = DP2_hlb_output.ToString();
|
|
|
|
proportion_td_scale.transform.localScale = 2 * new Vector3(1, 1, 1)*(float)DP2_td_output / DP2_output;
|
|
proportion_sm_scale.transform.localScale = 2 * new Vector3(1, 1, 1)*(float)DP2_sm_output / DP2_output;
|
|
proportion_qc_scale.transform.localScale = 2 * new Vector3(1, 1, 1)*(float)DP2_qc_output / DP2_output;
|
|
proportion_cm_scale.transform.localScale = 2 * new Vector3(1, 1, 1)*(float)DP2_cm_output / DP2_output;
|
|
proportion_dy_scale.transform.localScale = 2 * new Vector3(1, 1, 1)*(float)DP2_dy_output / DP2_output;
|
|
proportion_hlb_scale.transform.localScale = 2 * new Vector3(1, 1, 1)*(float)DP2_hlb_output / DP2_output;
|
|
break;
|
|
case GameState.DPlower:
|
|
time1 += Time.deltaTime;
|
|
if (time1 >= speed)
|
|
{
|
|
time1 = 0;
|
|
DP3_sm_maturity++;
|
|
DP3_qc_maturity++;
|
|
DP3_cm_maturity++;
|
|
if (DP3_sm_maturity > max_maturity) DP3_sm_maturity = min_maturity;
|
|
if (DP3_qc_maturity > max_maturity) DP3_qc_maturity = min_maturity;
|
|
if (DP3_cm_maturity > max_maturity) DP3_cm_maturity = min_maturity;
|
|
}
|
|
type_sm_number.text = DP3_sm_number.ToString();
|
|
type_qc_number.text = DP3_qc_number.ToString();
|
|
type_cm_number.text = DP3_cm_number.ToString();
|
|
type_sm_scale.text = DP3_sm_maturity.ToString();
|
|
type_qc_scale.text = DP3_qc_maturity.ToString();
|
|
type_cm_scale.text = DP3_cm_maturity.ToString();
|
|
|
|
distribute_A_number.text = DP3_area1_number.ToString();
|
|
distribute_B_number.text = DP3_area2_number.ToString();
|
|
distribute_C_number.text = DP3_area3_number.ToString();
|
|
distribute_D_number.text = DP3_area4_number.ToString();
|
|
distribute_A_scale.fillAmount = (float)DP3_area1_number / DP_3_number;
|
|
distribute_B_scale.fillAmount = (float)DP3_area2_number / DP_3_number;
|
|
distribute_C_scale.fillAmount = (float)DP3_area3_number / DP_3_number;
|
|
distribute_D_scale.fillAmount = (float)DP3_area4_number / DP_3_number;
|
|
|
|
proportion_td_number.text = DP3_td_output.ToString();
|
|
proportion_sm_number.text = DP3_sm_output.ToString();
|
|
proportion_qc_number.text = DP3_qc_output.ToString();
|
|
proportion_cm_number.text = DP3_cm_output.ToString();
|
|
proportion_dy_number.text = DP3_dy_output.ToString();
|
|
proportion_hlb_number.text = DP3_hlb_output.ToString();
|
|
|
|
proportion_td_scale.transform.localScale =2* new Vector3(1, 1, 1) * (float)DP3_td_output / DP3_output;
|
|
proportion_sm_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP3_sm_output / DP3_output;
|
|
proportion_qc_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP3_qc_output / DP3_output;
|
|
proportion_cm_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP3_cm_output / DP3_output;
|
|
proportion_dy_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP3_dy_output / DP3_output;
|
|
proportion_hlb_scale.transform.localScale = 2 * new Vector3(1, 1, 1) * (float)DP3_hlb_output / DP3_output;
|
|
break;
|
|
}
|
|
}
|
|
}
|