123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using DG.Tweening;
- using GameFramework;
- using GameFramework.Event;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.Serialization;
- using UnityEngine.UI;
- using UnityGameFramework.Runtime;
- public class AppTrainStudyForm : UIFormLogic
- {
- private GameObject _trainPanel;
- private GameObject _learnPanel;
- private GameObject _faultPanel;
-
- private GameObject _trainDoneTips;
- private GameObject _faultDoneTips;
- private Button _reStartButton;
-
- public Sprite[] learnModelButtonImg;
- public Sprite[] trainModelButtonImg;
- public Sprite[] bugModelButtonImg;
- private Button _learnButton;
- private Button _trainButton;
- private Button _faultButton;
- private IT_TrainModelType _currentType;
- private GameObject messagePanel;
- private Text nameText;
- private Text messageText;
-
- //todo App认知的文字
- private const string GSEMessage =
- "GSE作为管控平台,集成监控、调度与自动化,提供全方位系统管理,确保系统组件协同高效运行。通过智能调度和资源优化,实现高性能、稳定性和可扩展性的系统运维。";
- private const string CMDBMessage =
- "CMDB是配置管理数据库,详细记录系统组件配置信息,支持实时状态监测和智能配置管理。通过构建组件之间的关系图,实现对整个系统配置的清晰可视化,提供数据支持系统稳定性和可靠性。";
- private const string JobMessage =
- "Job作为作业平台,提供作业任务的调度和执行服务。通过灵活的调度策略,实现系统作业的自动化管理,优化任务执行效率,确保系统作业的高效执行和调度。";
- private const string PaaSMessage =
- "PaaS是集成平台,提供全套的开发、部署和运行平台。通过集成开发工具、服务和运行环境,简化应用程序的构建和管理,支持快速应用开发、测试和上线,推动业务创新。";
- private const string BKDataMessage =
- "BKData是大数据平台,专注于大规模数据处理与分析。提供高性能的数据存储和处理引擎,支持数据驱动决策,为企业提供强大的数据处理和分析能力。";
- private const string ApptSaaSMessage =
- "ApptSaaS为Saas应用提供专用测试环境,用于验证应用功能、性能和稳定性。通过模拟真实场景和大规模用户负载,确保Saas应用在发布前经过全面、严格的测试。";
- private const string AppoSaaSMessage =
- "AppoSaaS是Saas应用的正式生产环境,提供高可用、稳定和安全的服务。通过灵活的扩展性和自动化运维,确保用户在任何时间都能正常、高效地使用Saas应用。";
- private const string LicenseMessage =
- "License管理模块用于管理软件许可证和用户权限。通过严格的许可证管理,确保软件合法使用,同时支持许可证的分发、监控和维护。";
- private const string NginxWebMessage =
- "NginxWeb是高性能的Web服务器和反向代理,用于处理HTTP请求。支持负载均衡、反向代理和静态文件服务,提供快速、可靠的Web服务。";
- private const string MySQLMessage =
- "MySQL是开源的关系型数据库管理系统,用于存储和检索结构化数据。通过支持事务处理和复杂查询,提供稳定可靠的数据库服务。";
- private const string RedisMessage =
- "Redis是高性能的内存数据库,用于快速数据存储和检索。支持多种数据结构,适用于缓存、消息队列和实时数据处理等场景。";
- private const string ZookeeperMessage =
- "Zookeeper提供分布式系统协调服务,管理配置信息和分布式锁,确保系统的一致性和可用性。通过提供高度可靠的分布式协调支持,为复杂系统的协同运行提供基础。";
- private const string MongoDBMessage =
- "MongoDB是非关系型数据库管理系统,支持灵活的文档存储。适用于大数据和实时应用场景,提供高效、可扩展的数据库服务。";
- private const string RabbitMQMessage =
- "RabbitMQ是开源的消息队列系统,用于实现应用程序间的异步通信。支持事件驱动架构,提高系统的松耦合性和可扩展性。";
- private const string InfluxDBMessage =
- "InfluxDB是专注于时序数据的数据库,适用于监控和IoT场景。提供高效的时序数据存储和查询,满足大规模时序数据分析的需求。";
- private const string VirtualenvMessage =
- "Virtualenv是用于创建和管理Python虚拟环境的工具。通过实现项目隔离和依赖管理,提供灵活的Python环境支持。";
- private const string DockerMessage =
- "Docker提供容器化解决方案,封装应用及其依赖项,实现跨平台和快速部署。通过容器化技术,简化应用程序的开发、测试和部署流程,提高系统的灵活性和可移植性。";
-
- bool haveFixed = false;
- private GameObject tarinList;
- private Button trainB1;
- private Button trainB2;
-
- private GameObject faultList;
-
- //$$$
- public Button[] faultButtons;
- public GameObject faultChoicePanel;
- public GameObject[] faultChoices;
-
- protected override void OnInit(object userData)
- {
- base.OnInit(userData);
-
- _trainPanel = this.transform.Find("trainPanel").gameObject;
- _learnPanel = this.transform.Find("learnPanel").gameObject;
- _faultPanel = this.transform.Find("faultPanel").gameObject;
- InItUiComponent();
- }
- protected override void OnOpen(object userData)
- {
- base.OnOpen(userData);
- _trainDoneTips.SetActive(false);
- GameMain.Event.Subscribe(App_TrainStudyShowTargetInfoEvent.EventId,ChangeTargetMessage);
-
- _learnPanel.SetActive(true);
- _trainPanel.SetActive(false);
- _learnButton.image.sprite = learnModelButtonImg[1];
- _trainButton.image.sprite = trainModelButtonImg[0];
- _faultButton.image.sprite = bugModelButtonImg[0];
- ChangeToLearn(true,0.1f);
- tarinList.SetActive(false);
-
-
-
- //_currentType = IT_TrainModelType.learn;
- //GameMain.Event.Fire(this,IT_StartLearnTargetInfoEvent.Create());
- }
-
- protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
- {
- base.OnUpdate(elapseSeconds, realElapseSeconds);
- }
- private void InItUiComponent()
- {
-
- _trainDoneTips = _trainPanel.transform.Find("DoneTips").gameObject;
- _trainDoneTips.SetActive(false);
- messagePanel = _learnPanel.transform.Find("messagePanel").gameObject;
- messagePanel.SetActive(false);
- nameText = messagePanel.transform.Find("nameText").GetComponent<Text>();
- messageText = messagePanel.transform.Find("messageText").GetComponent<Text>();
-
- _faultDoneTips = _faultPanel.transform.Find("DoneTips").gameObject;
- _faultDoneTips.SetActive(false);
-
- _faultPanel.SetActive(false);
- _reStartButton = _trainPanel.transform.Find("TrainButton/Verlist/reStartButton").GetComponent<Button>();
-
- _reStartButton.onClick.AddListener(() =>
- {
- GameMain.Event.Fire(this,ReStart_IT_TrainStudyEvent.Create());
- });
-
- _learnButton = this.transform.Find("Navi/B1").GetComponent<Button>();
- _learnButton.onClick.AddListener(()=> {
- ChangeToLearn(true,0.1f);
- });
- _trainButton = this.transform.Find("Navi/B2").GetComponent<Button>();
- _trainButton.onClick.AddListener(ChangeToTrain);
- _faultButton = this.transform.Find("Navi/B3").GetComponent<Button>();
- _faultButton.onClick.AddListener(()=>
- {
- ChangeToFault();
- });
- tarinList = this.transform.Find("Navi/trainlist").gameObject;
- trainB1 = this.transform.Find("Navi/trainlist/B1").GetComponent<Button>();
- trainB2 = this.transform.Find("Navi/trainlist/B2").GetComponent<Button>();
-
- trainB1.onClick.AddListener(() =>
- {
- GameMain.Event.Fire(this,App_TrainAniEvent.Create(1));
- tarinList.SetActive(false);
- });
-
- trainB2.onClick.AddListener(() =>
- {
- GameMain.Event.Fire(this, App_TrainAniEvent.Create(2));
- tarinList.SetActive(false);
- });
-
- faultList = this.transform.Find("Navi/faultlist").gameObject;
-
- //$$$------------------------
- faultChoicePanel = this.transform.Find($"faultChoicePanel").gameObject;
- faultChoices = new GameObject[10];
- for (int i = 0; i < 10; i++)
- {
- faultChoices[i] = this.transform.Find($"faultChoicePanel/BG/Quest_{i + 1}").gameObject;
- faultChoices[i].SetActive(false);
- }
- faultChoicePanel.SetActive(false);
- faultButtons = new Button[10];
- for (int i = 0; i < 10; i++)
- {
- faultButtons[i] = this.transform.Find($"Navi/faultlist/B{i + 1}").GetComponent<Button>();
- }
- faultButtons[0].onClick.AddListener(() => { faultChoicesClick(0); });
- faultButtons[1].onClick.AddListener(() => { faultChoicesClick(1); });
- faultButtons[2].onClick.AddListener(() => { faultChoicesClick(2); });
- faultButtons[3].onClick.AddListener(() => { faultChoicesClick(3); });
- faultButtons[4].onClick.AddListener(() => { faultChoicesClick(4); });
- faultButtons[5].onClick.AddListener(() => { faultChoicesClick(5); });
- faultButtons[6].onClick.AddListener(() => { faultChoicesClick(6); });
- faultButtons[7].onClick.AddListener(() => { faultChoicesClick(7); });
- faultButtons[8].onClick.AddListener(() => { faultChoicesClick(8); });
- faultButtons[9].onClick.AddListener(() => { faultChoicesClick(9); });
- faultChoicePanel.SetActive(false);
- //$$$------------------------
-
- tarinList.SetActive(false);
- }
- //$$$------------------------
- private void faultChoicesClick(int index)
- {
- foreach (var objs in faultChoices)
- {
- objs.SetActive(false);
- }
- GameMain.Event.Fire(this, FaultChoicesChangeEvent.Create(index));
- faultChoices[index].SetActive(true);
- faultChoicePanel.SetActive(true);
- faultList.SetActive(false);
- }
- protected override void OnClose(bool isShutdown, object userData)
- {
- base.OnClose(isShutdown, userData);
- GameMain.Event.Unsubscribe(App_TrainStudyShowTargetInfoEvent.EventId,ChangeTargetMessage);
- }
- private async void ChangeToLearn(bool force = false,float delayTime = 0.0f)
- {
- if(_currentType==IT_TrainModelType.learn && !force)
- return;
-
- if (SceneManager.GetActiveScene().name != "TrainStudy6")
- SceneManager.LoadScene("TrainStudy6");
- tarinList.SetActive(false);
- await Task.Delay((int)(delayTime * 1000));
-
- GameMain.Event.Fire(this,App_TrainStudyStateEvent.Create(false));
- GameMain.Event.Fire(this,App_StartLearnTargetInfoEvent.Create());
-
- _currentType = IT_TrainModelType.learn;
- _learnButton.image.sprite = learnModelButtonImg[1];
- _trainButton.image.sprite = trainModelButtonImg[0];
- _faultButton.image.sprite = bugModelButtonImg[0];
- _trainPanel.SetActive(false);
- _learnPanel.SetActive(true);
- _faultPanel.SetActive(false);
- tarinList.SetActive(false);
- //$$$------------------------
- faultChoicePanel.SetActive(false);
- }
- private void ChangeToTrain()
- {
- faultList.SetActive(false);
- tarinList.SetActive(true);
- if(_currentType==IT_TrainModelType.train)
- return;
-
- _learnPanel.SetActive(false);
- _faultPanel.SetActive(false);
- _learnButton.image.sprite = learnModelButtonImg[0];
- _trainButton.image.sprite = trainModelButtonImg[1];
- _faultButton.image.sprite = bugModelButtonImg[0];
- _currentType = IT_TrainModelType.train;
-
- if (SceneManager.GetActiveScene().name != "TrainStudy6_1")
- SceneManager.LoadScene("TrainStudy6_1");
-
-
- //_trainPanel.SetActive(true);
- //$$$------------------------
- faultChoicePanel.SetActive(false);
- }
- private void ChangeToFault(bool force = false)
- {
- tarinList.SetActive(false);
-
- faultList.SetActive(true);
- GameMain.Event.Fire(this, Cool_TrainStudyStateEvent.Create(false));
- GameMain.Event.Fire(this, Cool_StartLearnTargetInfoEvent.Create(false));
- _learnButton.image.sprite = learnModelButtonImg[0];
- _trainButton.image.sprite = trainModelButtonImg[0];
- _faultButton.image.sprite = bugModelButtonImg[1];
- _faultPanel.SetActive(true);
- _trainPanel.SetActive(false);
- _learnPanel.SetActive(false);
- _currentType = IT_TrainModelType.fault;
- _faultPanel.transform.Find($"Doc").gameObject.SetActive(false);
- _faultPanel.transform.Find($"FixButton").gameObject.SetActive(false);
- _faultPanel.transform.Find($"Tools").GetComponent<RectTransform>().localPosition = new Vector3(1120, 0, 0);
- if (SceneManager.GetActiveScene().name != "TrainStudy6_2" || force)
- SceneManager.LoadScene("TrainStudy6_2");
- //$$$------------------------
- faultChoicePanel.SetActive(false);
- }
- private void ChangeTargetMessage(object sender,GameEventArgs e)
- {
- App_TrainStudyShowTargetInfoEvent args = (App_TrainStudyShowTargetInfoEvent)e;
- switch (args._Type)
- {
- case AppHardWaryType.GSE:
- nameText.text = "GSE 管控平台";
- messageText.text = GSEMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.CMDB:
- nameText.text = "CMDB配置平台";
- messageText.text = CMDBMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.Job:
- nameText.text = "Job作业平台";
- messageText.text = JobMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.PaaS:
- nameText.text = "PaaS集成平台";
- messageText.text = PaaSMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.BKData:
- nameText.text = "BKData数据平台";
- messageText.text = BKDataMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.ApptSaaS:
- nameText.text = "ApptSaaS测试环境";
- messageText.text = ApptSaaSMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.AppoSaaS:
- nameText.text = "AppoSaaS正式环境";
- messageText.text = AppoSaaSMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.License:
- nameText.text = "License许可";
- messageText.text = LicenseMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.NginxWeb:
- nameText.text = "NginxWeb服务器";
- messageText.text = NginxWebMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.MySQL:
- nameText.text = "MySQL关系型数据库";
- messageText.text = MySQLMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.Redis:
- nameText.text = "Redis内存数据库";
- messageText.text = RedisMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.Zookeeper:
- nameText.text = "Zookeeper分布式应用程序协调服务";
- messageText.text = ZookeeperMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.MongoDB:
- nameText.text = "MongoDB非关系型数据库";
- messageText.text = MongoDBMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.RabbitMQ:
- nameText.text = "RabbitMQ消息队列";
- messageText.text = RabbitMQMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.InfluxDB:
- nameText.text = "InfluxDB时序型数据库";
- messageText.text = InfluxDBMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.Virtualenv:
- nameText.text = "Virtualenv虚拟环境";
- messageText.text = VirtualenvMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.Docker:
- nameText.text = "Docker虚拟环境";
- messageText.text = DockerMessage;
- if (!messagePanel.activeSelf)
- {
- messagePanel.SetActive(true);
- }
- break;
- case AppHardWaryType.none:
- messagePanel.SetActive(false);
- break;
- }
- }
-
- private void ReSetTrainUI(object sender,GameEventArgs e)
- {
- _trainDoneTips.SetActive(false);
- }
- private void OnIT_TrainStudyDone(object sender, GameEventArgs e)
- {
- _trainDoneTips.SetActive(true);
- //GameMain.UI.OpenUIForm("Tips", "Pop");
- }
- }
|