440 lines
14 KiB
C#
440 lines
14 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Tenkoku.Core;
|
|
using UnityEngine;
|
|
using UnityEngine.PlayerLoop;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
public class Scenariopage : MonoBehaviour
|
|
{
|
|
public Button scenario_file_btn;//想定文件按钮
|
|
public RectTransform ScrollView_unpack;//打开保存退出按钮显示
|
|
public RectTransform Scenariofile_panl;//想定页面
|
|
public Image object_list_panl;//对象列表面板
|
|
public Image Radius_panl;//值范围面板
|
|
public Image mianban;//
|
|
public Button object_list_btn;//对象列表按钮
|
|
public Button basic_info_btn;//基本信息按钮
|
|
public Image basic_information_iamg;//基本信息面板
|
|
public Button off4_btn;//基本信息关闭按钮
|
|
public Button model_list_btn;//模型按钮
|
|
public RectTransform select_device_iamg;//模型页面
|
|
public Button verify;//设备信息确认按钮
|
|
public Button Cancel_btnn;//设备信息取消按钮
|
|
public Image details_panl;//设备详情页面
|
|
public Button Fork_off_btn;//设备详情叉掉面板
|
|
public Button queren_btn;//设备详情确认按钮
|
|
public Button quxiao_btn;//设备详情取消按钮
|
|
public Image model_panl;//模型页面按钮
|
|
public Button off_btn;//选择设备的关闭按钮
|
|
public RectTransform environment_configuration1;//环境页面
|
|
public Button environment_setting_btn;//环境按钮
|
|
public Button fork_off_btn;//关闭按钮
|
|
public Button send_back_btn;//返回按钮
|
|
public Button verify_bton1;//基本信息确定按钮
|
|
public Button cancel_bton1;//基本信息取消按钮
|
|
public Button huanjin_btn;//环境配置确认按钮
|
|
public Button huanjin_btn1;//环境配置取消按钮
|
|
public Button quan_btn;//全部按钮
|
|
public Button can_btn;//探测按钮
|
|
public Button lu_btn;//陆
|
|
public Button kong_btn;//空
|
|
public Button qita_btn;//其他
|
|
public Image moxin_yemian;//显示模型框
|
|
public Image moyin_yemian1;
|
|
public Image moyin_yemian2;
|
|
public Image moyin_yemian3;
|
|
public Image moyin_yemian4;
|
|
private bool scenario = true;
|
|
private bool model=true;
|
|
private bool duixiang=true;
|
|
public Button queding;
|
|
|
|
public Dropdown windDrop;
|
|
public Dropdown windDir;
|
|
|
|
public TenkokuModule tenkokuModule;
|
|
public Button unpack_btn;//想定编辑打开按钮
|
|
public Button save_btn;//保存按钮
|
|
public Button quit;//退出按钮
|
|
public Button setting_btn;//对象列表的第二个设置按钮
|
|
//值的范围面板
|
|
public Button off1_btn;//关闭范围值的按钮
|
|
public Button verify1_btn;//值的确认按钮
|
|
public Button cancel_btn;//值的关闭按钮
|
|
public Slider tiem_slider;//时间的滑条
|
|
public Text tiem_text;//和滑条显示对应的时间
|
|
public Slider smash_slider;//击毁的滑动条
|
|
public Text smash_text;//击毁数值显示
|
|
public Slider distance_slider;//距离滑动条
|
|
public Text distance_text;
|
|
public Slider Angle_slider;//角度滑动条
|
|
public Text angle_text;
|
|
//弹窗一
|
|
public Button shezhi_btn11;//
|
|
public Button off_btn23;
|
|
public Button guan_btn;
|
|
public Button qu_btn22;
|
|
public Slider shijian;
|
|
public Text shi_text;
|
|
public Slider xuslider;
|
|
public Text xusshi_text;
|
|
public Slider Rcs;
|
|
public Text Rcs_text;
|
|
|
|
|
|
void Start()
|
|
{
|
|
Scenario();//想定文件
|
|
Basic();//基本信息按钮
|
|
|
|
Environment1();//环境按钮
|
|
send_back_btn.onClick.AddListener(() =>
|
|
{
|
|
GameMain.tiao = false;
|
|
SceneManager.LoadScene("SampleScene");
|
|
});
|
|
SetLightValue(1f);
|
|
queding.onClick.AddListener(() =>
|
|
{
|
|
SetWindValue();
|
|
SetWindDirection();
|
|
environment_configuration1.gameObject.SetActive(false);
|
|
});
|
|
Jiben();//基本信息确认取消按钮
|
|
Huanjin();
|
|
Moxing();
|
|
Moxingxuanze();
|
|
Scenariofile();//想定文件下面按钮
|
|
Duixiaang();//对象列表按钮面板
|
|
Fanwei();//值的范围面板
|
|
TZYM();//弹窗
|
|
}
|
|
|
|
private void TZYM()
|
|
{
|
|
shezhi_btn11.onClick.AddListener(() =>
|
|
{
|
|
mianban.gameObject.SetActive(true);
|
|
});
|
|
off_btn23.onClick.AddListener(() =>
|
|
{
|
|
mianban.gameObject.SetActive(false);
|
|
});
|
|
guan_btn.onClick.AddListener(() =>
|
|
{
|
|
mianban.gameObject.SetActive(false);
|
|
});
|
|
qu_btn22.onClick.AddListener(() =>
|
|
{
|
|
mianban.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
tiem_text.text = tiem_slider.value.ToString("0")+"s";
|
|
smash_text.text = smash_slider.value.ToString("0")+"s";
|
|
distance_text.text = distance_slider.value.ToString("f1")+"km";
|
|
angle_text.text = Angle_slider.value.ToString("0")+"°";
|
|
shi_text.text=shijian.value.ToString("0")+"分钟";
|
|
xusshi_text.text = xuslider.value.ToString("f1") + "m/s";
|
|
Rcs_text.text = Rcs.value.ToString("f2");
|
|
}
|
|
private void Fanwei()
|
|
{
|
|
setting_btn.onClick.AddListener(() =>
|
|
{
|
|
Radius_panl.gameObject.SetActive(true);
|
|
});
|
|
off1_btn.onClick.AddListener(() =>
|
|
{
|
|
Radius_panl.gameObject.SetActive(false);
|
|
});
|
|
verify1_btn.onClick.AddListener(() =>
|
|
{
|
|
Radius_panl.gameObject.SetActive(false);
|
|
});
|
|
cancel_btn.onClick.AddListener(() =>
|
|
{
|
|
Radius_panl.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
|
|
private void Duixiaang()
|
|
{
|
|
object_list_btn.onClick.AddListener(() =>
|
|
{
|
|
if (duixiang==true)
|
|
{
|
|
model_panl.gameObject.SetActive(false);
|
|
Scenariofile_panl.gameObject.SetActive(false);
|
|
object_list_panl.gameObject.SetActive(true);
|
|
duixiang=false;
|
|
}
|
|
else
|
|
{
|
|
object_list_panl.gameObject.SetActive(false);
|
|
duixiang = true;
|
|
}
|
|
});
|
|
}
|
|
|
|
//
|
|
private void Scenariofile()
|
|
{
|
|
//想定文件下的打开按钮
|
|
unpack_btn.onClick.AddListener(() =>
|
|
{
|
|
model_panl.gameObject.SetActive(false);
|
|
ScrollView_unpack.gameObject.SetActive(false);
|
|
object_list_panl.gameObject.SetActive(false);
|
|
Scenariofile_panl.gameObject.SetActive(true);
|
|
|
|
});
|
|
//想定文件下的保存按钮
|
|
save_btn.onClick.AddListener(() =>
|
|
{
|
|
ScrollView_unpack.gameObject.SetActive(false);
|
|
});
|
|
//想定文件下的退出按钮
|
|
quit.onClick.AddListener(() =>
|
|
{
|
|
ScrollView_unpack.gameObject.SetActive(false);
|
|
});
|
|
//想定页面关闭按钮
|
|
//scenario_btnn.onClick.AddListener(() =>
|
|
//{
|
|
// Scenariofile_panl.gameObject.SetActive(false);
|
|
//});
|
|
//选择设备的关闭按钮
|
|
off_btn.onClick.AddListener(() =>
|
|
{
|
|
select_device_iamg.gameObject.SetActive(false);
|
|
});
|
|
//选择设备确认按钮
|
|
verify.onClick.AddListener(() =>
|
|
{
|
|
select_device_iamg.gameObject.SetActive(false);
|
|
});
|
|
//选择设备取消按钮
|
|
Cancel_btnn.onClick.AddListener(() =>
|
|
{
|
|
select_device_iamg.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 模型页面的相互跳转
|
|
/// </summary>
|
|
private void Moxingxuanze()
|
|
{
|
|
quan_btn.onClick.AddListener(() =>
|
|
{
|
|
moxin_yemian.gameObject.gameObject.SetActive(true);
|
|
moyin_yemian1.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian2.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian3.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian4.gameObject.gameObject.SetActive(false);
|
|
});
|
|
can_btn.onClick.AddListener(() =>
|
|
{
|
|
moxin_yemian.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian1.gameObject.gameObject.SetActive(true);
|
|
moyin_yemian2.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian3.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian4.gameObject.gameObject.SetActive(false);
|
|
});
|
|
lu_btn.onClick.AddListener(() =>
|
|
{
|
|
moxin_yemian.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian1.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian2.gameObject.gameObject.SetActive(true);
|
|
moyin_yemian3.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian4.gameObject.gameObject.SetActive(false);
|
|
});
|
|
kong_btn.onClick.AddListener(() =>
|
|
{
|
|
moxin_yemian.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian1.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian2.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian3.gameObject.gameObject.SetActive(true);
|
|
moyin_yemian4.gameObject.gameObject.SetActive(false);
|
|
});
|
|
qita_btn.onClick.AddListener(() =>
|
|
{
|
|
moxin_yemian.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian1.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian2.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian3.gameObject.gameObject.SetActive(false);
|
|
moyin_yemian4.gameObject.gameObject.SetActive(true);
|
|
});
|
|
|
|
|
|
}
|
|
/// <summary>
|
|
/// 模型数据库界面
|
|
/// </summary>
|
|
private void Moxing()
|
|
{
|
|
model_list_btn.onClick.AddListener(() =>
|
|
{
|
|
if (model==true)
|
|
{
|
|
environment_configuration1.gameObject.SetActive(false);
|
|
object_list_panl.gameObject.SetActive(false);
|
|
basic_information_iamg.gameObject.SetActive(false);
|
|
model_panl.gameObject.SetActive(true);
|
|
select_device_iamg.gameObject.SetActive(true);
|
|
model = false;
|
|
}
|
|
else
|
|
{
|
|
model_panl.gameObject.SetActive(false);
|
|
select_device_iamg.gameObject.SetActive(false);
|
|
model = true;
|
|
}
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 环境界面确认取消按钮
|
|
/// </summary>
|
|
private void Huanjin()
|
|
{
|
|
huanjin_btn.onClick.AddListener(() =>
|
|
{
|
|
environment_configuration1.gameObject.SetActive(false);
|
|
});
|
|
huanjin_btn1.onClick.AddListener(() =>
|
|
{
|
|
environment_configuration1.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 基本信息确定取消按钮
|
|
/// </summary>
|
|
private void Jiben()
|
|
{
|
|
verify_bton1.onClick.AddListener(() =>
|
|
{
|
|
basic_information_iamg.gameObject.SetActive(false);
|
|
});
|
|
cancel_bton1.onClick.AddListener(() =>
|
|
{
|
|
basic_information_iamg.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 环境按钮激活失活
|
|
/// </summary>
|
|
private void Environment1()
|
|
{
|
|
environment_setting_btn.onClick.AddListener(() =>
|
|
{
|
|
environment_configuration1.gameObject.SetActive(true);
|
|
basic_information_iamg.gameObject.SetActive(false);
|
|
select_device_iamg.gameObject.SetActive(false);
|
|
});
|
|
fork_off_btn.onClick.AddListener(() =>
|
|
{
|
|
environment_configuration1.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 基本信息页面激活失活
|
|
/// </summary>
|
|
private void Basic()
|
|
{
|
|
basic_info_btn.onClick.AddListener(() =>
|
|
{
|
|
basic_information_iamg.gameObject.SetActive(true);
|
|
environment_configuration1.gameObject.SetActive(false);
|
|
select_device_iamg.gameObject.SetActive(false);
|
|
});
|
|
off4_btn.onClick.AddListener(() =>
|
|
{
|
|
basic_information_iamg.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 想定文件地下页面失活激活
|
|
/// </summary>
|
|
private void Scenario()
|
|
{
|
|
scenario_file_btn.onClick.AddListener(() =>
|
|
{
|
|
if (scenario == true)
|
|
{
|
|
ScrollView_unpack.gameObject.SetActive(true);
|
|
scenario = false;
|
|
}
|
|
else
|
|
{
|
|
ScrollView_unpack.gameObject.SetActive(false);
|
|
Scenariofile_panl.gameObject.SetActive(false);
|
|
scenario = true;
|
|
}
|
|
});
|
|
}
|
|
|
|
public void SetRainValue(float value)
|
|
{
|
|
tenkokuModule.weather_RainAmt = Mathf.Lerp(0.0f, 1.0f, value);
|
|
}
|
|
public void SetSnowValue(float value)
|
|
{
|
|
tenkokuModule.weather_SnowAmt = Mathf.Lerp(0.0f, 1.0f, value);
|
|
}
|
|
|
|
public void SetWindValue()
|
|
{
|
|
//tenkokuModule.weather_WindAmt = Mathf.Lerp(0.0f, 1.0f, value);
|
|
tenkokuModule.weather_WindAmt = windDrop.value * 0.1f;
|
|
}
|
|
|
|
public void SetWindDirection()
|
|
{
|
|
float tempWindDir = 0;
|
|
switch (windDir.value)
|
|
{
|
|
case 1:
|
|
tempWindDir = 0.125f;
|
|
break;
|
|
case 2:
|
|
tempWindDir = 0.25f;
|
|
break;
|
|
case 3:
|
|
tempWindDir = 0.375f;
|
|
break;
|
|
case 4:
|
|
tempWindDir = 0.5f;
|
|
break;
|
|
case 5:
|
|
tempWindDir = 0.625f;
|
|
break;
|
|
case 6:
|
|
tempWindDir = 0.75f;
|
|
break;
|
|
case 7:
|
|
tempWindDir = 0.875f;
|
|
break;
|
|
case 8:
|
|
tempWindDir = 1f;
|
|
break;
|
|
}
|
|
tenkokuModule.weather_WindDir = Mathf.Lerp(0.0f, 1.0f, tempWindDir);
|
|
}
|
|
|
|
public void SetLightValue(float value)
|
|
{
|
|
float valueTemp = 1 - value;
|
|
tenkokuModule.weather_OvercastAmt = Mathf.Lerp(0.0f, 1.0f, valueTemp);
|
|
}
|
|
|
|
|
|
|
|
}
|