From e29060cbfe6b5a9743acb9b877fe5e733b48c7a0 Mon Sep 17 00:00:00 2001 From: chenxiangxue <910695411@qq.com> Date: Tue, 27 Feb 2024 13:42:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Adam/Utility/Sync/CreateRoomController.cs | 1 - Assets/Zion/Scripts/Score.meta | 8 - Assets/Zion/Scripts/Score/ScoreBase.cs | 175 ---- Assets/Zion/Scripts/Score/ScoreBase.cs.meta | 11 - .../Scripts/Score/ScoreJudge_FixedValue.cs | 170 ---- .../Score/ScoreJudge_FixedValue.cs.meta | 11 - Assets/Zion/Scripts/Score/ScoreObject.cs | 68 -- Assets/Zion/Scripts/Score/ScoreObject.cs.meta | 11 - Assets/Zion/Scripts/Socket.meta | 8 - Assets/Zion/Scripts/Socket/ByteArray.cs | 144 ---- Assets/Zion/Scripts/Socket/ByteArray.cs.meta | 11 - Assets/Zion/Scripts/Socket/ClientSocket.cs | 537 ------------ .../Zion/Scripts/Socket/ClientSocket.cs.meta | 11 - Assets/Zion/Scripts/Socket/MessageModel.cs | 67 -- .../Zion/Scripts/Socket/MessageModel.cs.meta | 11 - Assets/Zion/Scripts/Sync1.meta | 8 - .../Zion/Scripts/Sync1/FunctionSync_Active.cs | 49 -- .../Scripts/Sync1/FunctionSync_Active.cs.meta | 11 - .../Scripts/Sync1/FunctionSync_Animator.cs | 63 -- .../Sync1/FunctionSync_Animator.cs.meta | 11 - .../Zion/Scripts/Sync1/FunctionSync_Audio.cs | 72 -- .../Scripts/Sync1/FunctionSync_Audio.cs.meta | 11 - .../Sync1/FunctionSync_CreateObejct.cs | 111 --- .../Sync1/FunctionSync_CreateObejct.cs.meta | 11 - .../Scripts/Sync1/FunctionSync_Material.cs | 59 -- .../Sync1/FunctionSync_Material.cs.meta | 11 - .../Sync1/FunctionSync_MaterialTexture.cs | 123 --- .../FunctionSync_MaterialTexture.cs.meta | 11 - .../Zion/Scripts/Sync1/FunctionSync_Media.cs | 254 ------ .../Scripts/Sync1/FunctionSync_Media.cs.meta | 11 - .../Zion/Scripts/Sync1/FunctionSync_Parent.cs | 97 --- .../Scripts/Sync1/FunctionSync_Parent.cs.meta | 11 - .../Sync1/FunctionSync_ParticleSystem.cs | 71 -- .../Sync1/FunctionSync_ParticleSystem.cs.meta | 11 - .../Sync1/FunctionSync_PositionRoate.cs | 430 ---------- .../Sync1/FunctionSync_PositionRoate.cs.meta | 11 - .../Zion/Scripts/Sync1/FunctionSync_Scale.cs | 63 -- .../Scripts/Sync1/FunctionSync_Scale.cs.meta | 11 - .../Zion/Scripts/Sync1/FunctionSync_Text.cs | 68 -- .../Scripts/Sync1/FunctionSync_Text.cs.meta | 11 - .../Zion/Scripts/Sync1/FunctionSync_Video.cs | 173 ---- .../Scripts/Sync1/FunctionSync_Video.cs.meta | 11 - Assets/Zion/Scripts/Sync1/MyPlayer.cs | 105 --- Assets/Zion/Scripts/Sync1/MyPlayer.cs.meta | 11 - Assets/Zion/Scripts/Sync1/NetMqListener.cs | 144 ---- .../Zion/Scripts/Sync1/NetMqListener.cs.meta | 11 - Assets/Zion/Scripts/Sync1/NetMqPublisher.cs | 108 --- .../Zion/Scripts/Sync1/NetMqPublisher.cs.meta | 11 - .../Zion/Scripts/Sync1/OneValueSyncObject.cs | 272 ------ .../Scripts/Sync1/OneValueSyncObject.cs.meta | 11 - Assets/Zion/Scripts/Sync1/PlayerMove.cs | 115 --- Assets/Zion/Scripts/Sync1/PlayerMove.cs.meta | 11 - Assets/Zion/Scripts/Sync1/SyncBase.cs | 16 - Assets/Zion/Scripts/Sync1/SyncBase.cs.meta | 11 - Assets/Zion/Scripts/Sync1/SyncTest.cs | 107 --- Assets/Zion/Scripts/Sync1/SyncTest.cs.meta | 11 - Assets/Zion/Scripts/UI.meta | 8 - Assets/Zion/Scripts/UI/CheckPanel.cs | 189 ----- Assets/Zion/Scripts/UI/CheckPanel.cs.meta | 11 - Assets/Zion/Scripts/UI/ChoseUserPanel.cs | 97 --- Assets/Zion/Scripts/UI/ChoseUserPanel.cs.meta | 11 - Assets/Zion/Scripts/UI/CreateRoomPanel.cs | 316 ------- .../Zion/Scripts/UI/CreateRoomPanel.cs.meta | 11 - Assets/Zion/Scripts/UI/IPsettingPanel.cs | 95 --- Assets/Zion/Scripts/UI/IPsettingPanel.cs.meta | 11 - Assets/Zion/Scripts/UI/Item.meta | 8 - .../Scripts/UI/Item/CheckPanelSeatItem.cs | 73 -- .../UI/Item/CheckPanelSeatItem.cs.meta | 11 - .../Scripts/UI/Item/CheckPanelSubjectItem.cs | 169 ---- .../UI/Item/CheckPanelSubjectItem.cs.meta | 11 - Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs | 33 - .../Scripts/UI/Item/ChoseUserItem.cs.meta | 11 - .../Scripts/UI/Item/CreateRoomSubjectItem.cs | 80 -- .../UI/Item/CreateRoomSubjectItem.cs.meta | 11 - .../Scripts/UI/Item/CreateRoomThinkingItem.cs | 71 -- .../UI/Item/CreateRoomThinkingItem.cs.meta | 11 - Assets/Zion/Scripts/UI/Item/RoomItem.cs | 89 -- Assets/Zion/Scripts/UI/Item/RoomItem.cs.meta | 11 - Assets/Zion/Scripts/UI/Item/席位分配.meta | 8 - .../UI/Item/席位分配/CreateRoomSeatItem.cs | 39 - .../Item/席位分配/CreateRoomSeatItem.cs.meta | 11 - .../UI/Item/席位分配/SeatBindSeatItem.cs | 18 - .../UI/Item/席位分配/SeatBindSeatItem.cs.meta | 11 - .../UI/Item/席位分配/SeatBindSubjectItem.cs | 21 - .../Item/席位分配/SeatBindSubjectItem.cs.meta | 11 - Assets/Zion/Scripts/UI/LoginPanel.cs | 159 ---- Assets/Zion/Scripts/UI/LoginPanel.cs.meta | 11 - Assets/Zion/Scripts/UI/MessagePanel.cs | 61 -- Assets/Zion/Scripts/UI/MessagePanel.cs.meta | 11 - Assets/Zion/Scripts/UI/RoomListPanel.cs | 156 ---- Assets/Zion/Scripts/UI/RoomListPanel.cs.meta | 11 - Assets/Zion/Scripts/UI/SystrmSettingPanel.cs | 55 -- .../Scripts/UI/SystrmSettingPanel.cs.meta | 11 - Assets/Zion/Scripts/manage/GameManage.cs | 588 ------------- Assets/Zion/Scripts/manage/GameManage.cs.meta | 11 - Assets/Zion/Scripts/manage/LoadManage.cs | 793 ------------------ Assets/Zion/Scripts/manage/LoadManage.cs.meta | 11 - Assets/Zion/Scripts/manage/MyClass.cs | 4 + Assets/Zion/Scripts/manage/MyNetMQClient.cs | 269 ------ .../Zion/Scripts/manage/MyNetMQClient.cs.meta | 11 - Assets/Zion/Scripts/manage/ScoreManage.cs | 90 -- .../Zion/Scripts/manage/ScoreManage.cs.meta | 11 - Assets/Zion/Scripts/manage/SoftManage.cs | 195 ----- Assets/Zion/Scripts/manage/SoftManage.cs.meta | 11 - 104 files changed, 4 insertions(+), 7894 deletions(-) delete mode 100644 Assets/Zion/Scripts/Score.meta delete mode 100644 Assets/Zion/Scripts/Score/ScoreBase.cs delete mode 100644 Assets/Zion/Scripts/Score/ScoreBase.cs.meta delete mode 100644 Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs delete mode 100644 Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs.meta delete mode 100644 Assets/Zion/Scripts/Score/ScoreObject.cs delete mode 100644 Assets/Zion/Scripts/Score/ScoreObject.cs.meta delete mode 100644 Assets/Zion/Scripts/Socket.meta delete mode 100644 Assets/Zion/Scripts/Socket/ByteArray.cs delete mode 100644 Assets/Zion/Scripts/Socket/ByteArray.cs.meta delete mode 100644 Assets/Zion/Scripts/Socket/ClientSocket.cs delete mode 100644 Assets/Zion/Scripts/Socket/ClientSocket.cs.meta delete mode 100644 Assets/Zion/Scripts/Socket/MessageModel.cs delete mode 100644 Assets/Zion/Scripts/Socket/MessageModel.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs delete mode 100644 Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/MyPlayer.cs delete mode 100644 Assets/Zion/Scripts/Sync1/MyPlayer.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/NetMqListener.cs delete mode 100644 Assets/Zion/Scripts/Sync1/NetMqListener.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/NetMqPublisher.cs delete mode 100644 Assets/Zion/Scripts/Sync1/NetMqPublisher.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs delete mode 100644 Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/PlayerMove.cs delete mode 100644 Assets/Zion/Scripts/Sync1/PlayerMove.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/SyncBase.cs delete mode 100644 Assets/Zion/Scripts/Sync1/SyncBase.cs.meta delete mode 100644 Assets/Zion/Scripts/Sync1/SyncTest.cs delete mode 100644 Assets/Zion/Scripts/Sync1/SyncTest.cs.meta delete mode 100644 Assets/Zion/Scripts/UI.meta delete mode 100644 Assets/Zion/Scripts/UI/CheckPanel.cs delete mode 100644 Assets/Zion/Scripts/UI/CheckPanel.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/ChoseUserPanel.cs delete mode 100644 Assets/Zion/Scripts/UI/ChoseUserPanel.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/CreateRoomPanel.cs delete mode 100644 Assets/Zion/Scripts/UI/CreateRoomPanel.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/IPsettingPanel.cs delete mode 100644 Assets/Zion/Scripts/UI/IPsettingPanel.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/RoomItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/RoomItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/席位分配.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs delete mode 100644 Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/LoginPanel.cs delete mode 100644 Assets/Zion/Scripts/UI/LoginPanel.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/MessagePanel.cs delete mode 100644 Assets/Zion/Scripts/UI/MessagePanel.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/RoomListPanel.cs delete mode 100644 Assets/Zion/Scripts/UI/RoomListPanel.cs.meta delete mode 100644 Assets/Zion/Scripts/UI/SystrmSettingPanel.cs delete mode 100644 Assets/Zion/Scripts/UI/SystrmSettingPanel.cs.meta delete mode 100644 Assets/Zion/Scripts/manage/GameManage.cs delete mode 100644 Assets/Zion/Scripts/manage/GameManage.cs.meta delete mode 100644 Assets/Zion/Scripts/manage/LoadManage.cs delete mode 100644 Assets/Zion/Scripts/manage/LoadManage.cs.meta delete mode 100644 Assets/Zion/Scripts/manage/MyNetMQClient.cs delete mode 100644 Assets/Zion/Scripts/manage/MyNetMQClient.cs.meta delete mode 100644 Assets/Zion/Scripts/manage/ScoreManage.cs delete mode 100644 Assets/Zion/Scripts/manage/ScoreManage.cs.meta delete mode 100644 Assets/Zion/Scripts/manage/SoftManage.cs delete mode 100644 Assets/Zion/Scripts/manage/SoftManage.cs.meta diff --git a/Assets/Zion/Scripts/Adam/Utility/Sync/CreateRoomController.cs b/Assets/Zion/Scripts/Adam/Utility/Sync/CreateRoomController.cs index ff7e10dd..6e080c90 100644 --- a/Assets/Zion/Scripts/Adam/Utility/Sync/CreateRoomController.cs +++ b/Assets/Zion/Scripts/Adam/Utility/Sync/CreateRoomController.cs @@ -26,7 +26,6 @@ namespace AdamSync public GameObject registInfoPanel; public Button registConfirmBtn; - public RoomItem roomItemPrefab; public Transform roomItemParent; public RoomInstructController roomInstructController; diff --git a/Assets/Zion/Scripts/Score.meta b/Assets/Zion/Scripts/Score.meta deleted file mode 100644 index 7162d4e9..00000000 --- a/Assets/Zion/Scripts/Score.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 37f3ff4babdf2324280ea5cde7e1d28c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Score/ScoreBase.cs b/Assets/Zion/Scripts/Score/ScoreBase.cs deleted file mode 100644 index 35cbf2a0..00000000 --- a/Assets/Zion/Scripts/Score/ScoreBase.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Xml; -using UnityEngine; -using System.Linq; -using DataModel.Model; -using LitJson; - -public class ScoreBase : MonoBehaviour -{ - /// - /// 评估序号 - /// - public int code; - /// - /// 评估点 - /// - [DisplayOnly] - public string scoreName; - /// - /// 岗位名 - /// - [DisplayOnly] - public string seatName; - /// - /// 步骤序号 - /// - [DisplayOnly] - public int stepOrder; - /// - /// 分值 - /// - [DisplayOnly] - public int scoreValue; - - [Header("如果有前置打分点,则配置有效")] - /// - /// 是否有前置打分点 - /// - public bool hasFrontPoint; - /// - /// 前置评估点编号 - /// - public int frontScorePointCode; - /// - /// 前置打分点 - /// - [HideInInspector] - public ScoreBase frontScorePoint; - - [Header("==============")] - - /// - /// 评分点是否正确 - /// - [DisplayOnly] - public bool IsRight; - - /// - /// 是否激活 - /// - [DisplayOnly] - public bool IsActive = false; - - /// - /// 判断点完成顺序 - /// - [HideInInspector] - public int Completed = 0; - - - public virtual void Init(string subjectName,int code) - { - this.code = code; - XmlNode node = ScoreManage.scoreXML.SelectSingleNode("root/Sub_" + subjectName); - foreach (XmlNode item in node.ChildNodes) - { - if(item.Attributes["code"].Value==code.ToString()) - { - scoreName = item.Attributes["Text"].Value; - seatName= item.Attributes["seatName"].Value; - scoreValue = int.Parse(item.Attributes["scoreValue"].Value); - stepOrder = int.Parse(item.Attributes["stepOrder"].Value); - break; - } - } - - //获取前置 - if (hasFrontPoint) - { - ScoreBase sb= transform.parent.GetComponentsInChildren(true).ToList().Find(a => a.code == frontScorePointCode); - if(sb!=null) - { - frontScorePoint = sb; - } - else - { - Debug.LogError("前置条件错误:" + subjectName + " " + code); - } - } - } - - - /// - /// 激活(按科目激活) - /// - public virtual void SetActive(bool isActive) - { - IsActive = isActive; - if(isActive) - { - transform.GetComponentsInChildren(true).ToList().ForEach(a => - { - a.AddAction(); - }); - } - else - { - transform.GetComponentsInChildren(true).ToList().ForEach(a => - { - a.RemoveAction(); - }); - } - } - - - public virtual void SetIsRight() - { - - } - - /// - /// 提交分表分数 (暂定点击步骤结束提交) - /// - public virtual void Submit() - { - if (IsActive) - { - SetActive(false); - appraisedetail appraisedetail = new appraisedetail - { - Id = System.Guid.NewGuid().ToString(), - PracticeId = LoadManage.Instance.currentPractice.Id, - AppraiseId = LoadManage.Instance.currentPractice.Id, - SubjectId = LoadManage.Instance.psubjects.Find(a => a.Name == transform.parent.name).SubjectId, - PracticeSubjectId= LoadManage.Instance.psubjects.Find(a => a.Name == transform.parent.name).Id, - UserAccount = LoadManage.Instance.me.user.user_name, - RoleName = seatName, - Idx = code, - Notice = scoreName, - Score = (IsRight ? 0 : -scoreValue), - Completed=(IsRight ? 1:0) - }; - - - //提交数据库 - string url = "http://"+MyNetMQClient.CallIP+ "/Handler/Api_Appraise.ashx"; - var tmp= new KeyValuePair[2]; - tmp[0] = new KeyValuePair("action", "setScore"); - tmp[1] = new KeyValuePair("appraiseDetail", JsonMapper.ToJson(appraisedetail)); - StartCoroutine(MyNetMQClient.CallPost(url, tmp, result => - { - var json = JsonMapper.ToObject(result); - if (json.state) - { - Debug.Log("上传分数:++++++++++++++++++++++++++++++" + JsonMapper.ToJson(appraisedetail)); - } - else - { - Debug.Log(json.message); - } - })); - } - } -} diff --git a/Assets/Zion/Scripts/Score/ScoreBase.cs.meta b/Assets/Zion/Scripts/Score/ScoreBase.cs.meta deleted file mode 100644 index d756f83e..00000000 --- a/Assets/Zion/Scripts/Score/ScoreBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ef3666abb6f9b174a8d7396d0363e3ac -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs b/Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs deleted file mode 100644 index 1f7eb650..00000000 --- a/Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System.Text; - -/// -/// 配置单值判断标准 -/// -public class ScoreJudge_FixedValue : MonoBehaviour -{ - public string 备注; - - [SerializeField] - [HideInInspector] - public OneValueSyncObject oneValueSyncObject; - - - [SerializeField] - [HideInInspector] - public bool mybool; - - [SerializeField] - [HideInInspector] - public byte mybyte; - - [SerializeField] - [HideInInspector] - public short myshort; - - [SerializeField] - [HideInInspector] - public int myint; - - [SerializeField] - [HideInInspector] - public float myfloat; - - [SerializeField] - [HideInInspector] - public double mydouble; - - [SerializeField] - [HideInInspector] - public string mystring; - - [SerializeField] - [HideInInspector] - public Vector3 myvector3; - - /// - /// 是否正确 - /// - [DisplayOnly] - public bool Isright; - /// - /// 所属打分点 - /// - [HideInInspector] - public ScoreBase scoreBase; - - /// - /// 完成顺序 - /// - [HideInInspector] - public int index=-1; - - - public void Init(ScoreBase scoreBase) - { - this.scoreBase = scoreBase; - if(oneValueSyncObject==null) - { - Debug.LogError(备注); - } - } - - public void AddAction() - { - oneValueSyncObject.action_apprisedetail += TrySetScore; - Debug.Log("添加打分回调:"+ oneValueSyncObject.Id); - } - - public void RemoveAction() - { - oneValueSyncObject.action_apprisedetail -= TrySetScore; - Debug.Log("移除打分回调:"+ oneValueSyncObject.Id); - } - - /// - /// 尝试判对 - /// - public void TrySetScore() - { - if (!Isright && scoreBase.IsActive) - { - //判断前置条件 - if (scoreBase.hasFrontPoint && !scoreBase.frontScorePoint.IsRight) - { - return; - } - - switch (oneValueSyncObject.valueType) - { - case ValueType.Null: - Debug.LogError("错误"); - return; - case ValueType.Bool: - if (mybool == oneValueSyncObject.mybool) - { - Isright=true; - } - break; - case ValueType.Byte: - if (mybyte == oneValueSyncObject.mybyte) - { - Isright = true; - } - break; - case ValueType.Short: - if (myshort == oneValueSyncObject.myshort) - { - Isright = true; - } - break; - case ValueType.Int: - if (myint == oneValueSyncObject.myint) - { - Isright = true; - } - break; - case ValueType.Float: - if (myfloat == oneValueSyncObject.myfloat) - { - Isright = true; - } - break; - case ValueType.Double: - if (mydouble == oneValueSyncObject.mydouble) - { - Isright = true; - } - break; - case ValueType.String: - if (mystring == oneValueSyncObject.mystring) - { - Isright = true; - } - break; - case ValueType.Vector3: - if (myvector3 == oneValueSyncObject.myvector3) - { - Isright = true; - } - break; - default: - Debug.LogError("错误"); - return; - } - - if (Isright) - { - index = scoreBase.Completed; - scoreBase.Completed++; - scoreBase.SetIsRight(); - //操作点 | 科目物体名称 | 评估点序号 | 操作点物体名称 | index - MyNetMQClient.instance.Send(LoadManage.Instance.currentRoomArea, 70, Encoding.UTF8.GetBytes("操作点" + "|" + scoreBase.transform.parent.name + "|" + scoreBase.code + "|" + gameObject.name +"|"+index)); - } - } - } -} diff --git a/Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs.meta b/Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs.meta deleted file mode 100644 index 4c4d98dd..00000000 --- a/Assets/Zion/Scripts/Score/ScoreJudge_FixedValue.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5a02eb8717f80ae429d04eb922b8ec5c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Score/ScoreObject.cs b/Assets/Zion/Scripts/Score/ScoreObject.cs deleted file mode 100644 index 4f23713a..00000000 --- a/Assets/Zion/Scripts/Score/ScoreObject.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System.Linq; -using System.Text; - -/// -/// 固定值打分 -/// -public class ScoreObject : ScoreBase -{ - /// - /// 是否有序 - /// - [SerializeField] - public ScoreType scoreType; - - /// - /// 判断标准 - /// - List list; - - - public override void Init(string subjectName, int code) - { - base.Init(subjectName, code); - - list = transform.GetComponentsInChildren(true).ToList(); - if(list==null) - { - Debug.LogError("错误,不能为空"); - } - else - { - list.ForEach(a => - { - a.Init(this); - }); - } - } - - /// - /// 获取评估点对错 - /// - /// - public override void SetIsRight() - { - if (!IsRight) - { - switch (scoreType) - { - case ScoreType.无序: - IsRight= list.All(a => a.Isright); - break; - case ScoreType.有序: - IsRight= list.All(a => a.Isright && a.index == list.IndexOf(a)); - break; - } - - if(IsRight) - { - //评估点 | 科目物体名称 | 评估点序号 | 当前index - MyNetMQClient.instance.Send(LoadManage.Instance.currentRoomArea, 70, Encoding.UTF8.GetBytes("评估点|"+transform.parent.name+"|"+code+"|"+Completed)); - } - } - } - -} diff --git a/Assets/Zion/Scripts/Score/ScoreObject.cs.meta b/Assets/Zion/Scripts/Score/ScoreObject.cs.meta deleted file mode 100644 index 80a0feb9..00000000 --- a/Assets/Zion/Scripts/Score/ScoreObject.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 90e504cd920201448b62630b72e006d0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Socket.meta b/Assets/Zion/Scripts/Socket.meta deleted file mode 100644 index 5ceebfee..00000000 --- a/Assets/Zion/Scripts/Socket.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5acb8fb1052be364db480657a58d73ca -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Socket/ByteArray.cs b/Assets/Zion/Scripts/Socket/ByteArray.cs deleted file mode 100644 index 640c9864..00000000 --- a/Assets/Zion/Scripts/Socket/ByteArray.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.IO; - -public class ByteArray -{ - MemoryStream ms = new MemoryStream(); - BinaryReader br; - BinaryWriter bw; - public ByteArray() - { - bw = new BinaryWriter(ms); - br = new BinaryReader(ms); - } - - public ByteArray(byte[] buff) - { - ms = new MemoryStream(buff); - br = new BinaryReader(ms); - bw = new BinaryWriter(ms); - } - - - #region 读取消息 - public void Read(out int vaule) - { - vaule = br.ReadInt32(); - } - public void Read(out byte value) - { - value = br.ReadByte(); - } - public void Read(out byte[] vaule, int length) - { - vaule = br.ReadBytes(length); - } - public void Read(out bool value) - { - value = br.ReadBoolean(); - } - public void Read(out string value) - { - value = br.ReadString(); - } - public void Read(out long value) - { - value = br.ReadInt64(); - } - public void Read(out double value) - { - value = br.ReadDouble(); - } - public void Read(out float value) - { - value = br.ReadSingle(); - } - #endregion - - #region 编写消息 - public void Write(int value) - { - bw.Write(value); - } - public void Write(byte value) - { - bw.Write(value); - } - public void Write(bool value) - { - bw.Write(value); - } - public void Write(byte[] value) - { - bw.Write(value); - } - public void Write(string value) - { - bw.Write(value); - } - public void Write(long value) - { - bw.Write(value); - } - public void Write(double value) - { - bw.Write(value); - } - public void Write(float value) - { - bw.Write(value); - } - - #endregion - - - public int Length - { - get - { - return (int)ms.Length; - } - } - public int Position - { - get - { - return (int)ms.Position; - } - } - - /// - /// 是否读取完了 - /// - public bool ReadOver - { - get - { - if (Position < Length) - { - return true; - } - else - { - return false; - } - } - } - - /// - /// 关闭读写 - /// - public void Close() - { - br.Close(); - bw.Close(); - ms.Close(); - } - - public byte[] GetBuffer() - { - byte[] result = new byte[ms.Length]; - Buffer.BlockCopy(ms.GetBuffer(), 0, result, 0, (int)ms.Length); - return result; - } -} diff --git a/Assets/Zion/Scripts/Socket/ByteArray.cs.meta b/Assets/Zion/Scripts/Socket/ByteArray.cs.meta deleted file mode 100644 index ea450a8d..00000000 --- a/Assets/Zion/Scripts/Socket/ByteArray.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a2fdde09d86a5f438d0725b1be508d6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Socket/ClientSocket.cs b/Assets/Zion/Scripts/Socket/ClientSocket.cs deleted file mode 100644 index 6f13eec7..00000000 --- a/Assets/Zion/Scripts/Socket/ClientSocket.cs +++ /dev/null @@ -1,537 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Threading; -using UnityEngine; - -/// -/// 客户端socket是属于那一种处理方式 -/// -public enum OpenClientSocketEnum -{ - Null, - 客户端, - 服务端 -} - -public class ClientSocket -{ - #region 网络模块 - public Socket socket; - public byte[] readBuff; - List cache = new List(); - public List reciveMessagejosn = new List();//收到的消息列表 - public List sendMessages = new List();//发送列表 - private bool isreading = false; - public bool threadRun = true;//线程运行控制 - public Action closeExeCallBack = null;//关闭exe回调 - public Action zhiHuiCallBack = null;//指挥回调 - // public Timer timer; - public byte[] currentMessage; - public OpenClientSocketEnum openClientSocketEnum;//打开类型 - - public bool success = true;//是否成功发送消息 - - - - public ClientSocket(Socket tmpsocket, OpenClientSocketEnum openClientSocketEnum) - { - readBuff = new byte[1024]; - socket = tmpsocket; - socket.ReceiveTimeout = 8000; - socket.SendTimeout = 8000; - this.openClientSocketEnum = openClientSocketEnum; - // timer = new Timer(TimerCallBack, currentMessage, Timeout.Infinite, 10000); - } - - /// - ///接收数据(线程) - /// - public void BeginRecv() - { - UnityEngine.Debug.Log("开始接收消息"); - socket.BeginReceive(readBuff, 0, 1024, SocketFlags.None, ReciveCallBack, readBuff);//开始接收客户端发送字节 - } - /// - /// 接收回调委托 - /// - /// - public void ReciveCallBack(IAsyncResult ar) - { - try - { - int length = socket.EndReceive(ar);//接收完成 - byte[] massge = new byte[length]; - //接受0字节关闭socket - if(length==0) - { - if(openClientSocketEnum == OpenClientSocketEnum.客户端) - { - threadRun = false; - if(socket.Connected) - { - socket.Shutdown(SocketShutdown.Both); - } - socket.Close(); - // ServerSocket.socketList.Remove(this); - } - } - Buffer.BlockCopy(readBuff, 0, massge, 0, length);//拷贝消息 - cache.AddRange(massge);//存储消息 - if (isreading == false) - { - isreading = true; - OnDate();//解析数据 - } - else - { - Console.WriteLine("数据正在被读"); - } - if (threadRun == true) - { - //递归 - if (socket == null) - { - threadRun = false; - } - else - { - if (!socket.Connected) - { - threadRun = false; - socket.Close(); - } - } - - if (socket != null) - { - socket.BeginReceive(readBuff, 0, 1024, SocketFlags.None, ReciveCallBack, readBuff);//接收下一条消息 - } - } - //else - //{ - // return; - //} - } - catch(Exception e) - { - UnityEngine.Debug.Log("接受线程异常"+e.Message); - if (openClientSocketEnum == OpenClientSocketEnum.客户端) - { - if (fangzhenClient != null && this == fangzhenClient) - { - if (!fangzhenClient.socket.Connected) - { - //断线重连 - ConnectFangZhenSocekt(LoadManage.Instance.currentPractice.IpAddress, LoadManage.Instance.currentPractice.Port.Value); - } - //CloseFangZhenSocket(); - } - } - } - } - - /// - /// 解析消息 - /// - public void OnDate() - { - //反序列化 - byte[] result = Decode(ref cache); - - //如果解析完了,重新置为可读 - if (result == null) - { - isreading = false; - return; - } - - //消息体解码 - string message = Mdecode(result); - if (message == null) - { - Console.WriteLine("message为空"); - isreading = false; - return; - } - - //存储消息体(json) - //reciveMessagejosn.Add(message); - //处理消息 - if (openClientSocketEnum == OpenClientSocketEnum.客户端) - { - MessageRecive(message); - } - OnDate();//递归,直到全部解析完成 - } - - /// - ///消息体长度解码(去头部) - /// - /// - public byte[] Decode(ref List cache) - { - if (cache.Count < 4) - { - return null; - } - - MemoryStream ms = new MemoryStream(cache.ToArray());//内存流读写消息 - BinaryReader br = new BinaryReader(ms);//二进制读取 - int length = br.ReadInt32();//读取头部4个字节,得到消息内容长度 - - if (length > ms.Length - ms.Position)//消息不完整 - { - //UnityEngine.Debug.Log("消息不完整"); - return null; - } - byte[] result = br.ReadBytes(length);//光标继续移动,读取消息内容 - - cache.Clear();//清空消息 - cache.AddRange(br.ReadBytes((int)(ms.Length - ms.Position)));//去掉第一个消息 - - br.Close(); - ms.Close(); - - return result; - } - - /// - /// 消息体内容解析(json字符串) - /// - /// - /// - public string Mdecode(byte[] value) - { - string jsonStr = Encoding.UTF8.GetString(value);//反序列化为jstring - return jsonStr; - } - /// - /// 加入发送队列(改成直接发送消息) - /// - /// - public void ReadySend(MessageModel message) - { - try - { - if(!this.socket.Connected) - { - UnityEngine.Debug.Log("未连接,发送失败"); - return; - } - if (message == null) - { - return; - } - //实例化一个消息对象 - - string jsonstr = LitJson.JsonMapper.ToJson(message); - byte[] ba = Encoding.UTF8.GetBytes(jsonstr);//得到byte[] message - if (ba.Length == 0) - { - return; - } - - //长度编码 - ByteArray arr = new ByteArray(); - - arr.Write(ba.Length); - arr.Write(ba); - - byte[] sendBuffer = arr.GetBuffer(); - socket.Send(sendBuffer); - } - catch(Exception e) - { - UnityEngine.Debug.Log("发送错误"+e.Message); - if (openClientSocketEnum == OpenClientSocketEnum.客户端) - { - if (fangzhenClient != null && this == fangzhenClient) - { - if(!fangzhenClient.socket.Connected) - { - //断线重连 - ConnectFangZhenSocekt(LoadManage.Instance.currentPractice.IpAddress, LoadManage.Instance.currentPractice.Port.Value); - } - //CloseFangZhenSocket(); - } - } - } - } - /// - /// 处理消息 - /// - public void MessageRecive(string json) - { - try - { - if (json == null || json == "") - { - return; - } - MessageModel message = LitJson.JsonMapper.ToObject(json); - switch (message.operationEnum) - { - case SimOperationEnum.指挥指令服务端: - //步骤 - if (zhiHuiCallBack != null) - { - zhiHuiCallBack(true, message.str); - zhiHuiCallBack = null; - } - else - { - // HandleResult._Instance.zhiHuiStr.AddRange(JsonConvert.DeserializeObject>(message.str)); - } - break; - case SimOperationEnum.科目启停服务端: - //转发给给服务器 - //HandleResult._Instance.subjectSet.Add(message.str); - break; - case SimOperationEnum.科目切换服务端: - //HandleResult._Instance.changeSubject.Add(message); - break; - case SimOperationEnum.操作软件二维端: - //操作软件发来的 - //SoftManage.Instance.Soft.Add(message); - break; - } - } - catch(Exception e) - { - UnityEngine.Debug.LogWarning(json); - UnityEngine.Debug.LogWarning(e.Message); - } - } - #endregion - - #region 协同交互调用模块 - public static ClientSocket fangzhenClient;//客户端socket连接仿真服务器 - - /// - /// 连接仿真服务器 - /// - public static void ConnectFangZhenSocekt(string serverIP, int port,Action action=null) - { - UnityEngine.Debug.Log("开启仿真服务器客户端socket:"+ serverIP+ ":port"); - if (fangzhenClient!=null && fangzhenClient.socket.Connected) - { - UnityEngine.Debug.Log("仿真客户端不为空"); - if (action != null) - { - action(true); - } - } - else - { - try - { - UnityEngine.Debug.Log("正在连接仿真服务器中。。。。"); - Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - socket.Connect(IPAddress.Parse(serverIP), port); - if (socket.Connected) - { - UnityEngine.Debug.Log("连接成功"); - //创建客户端对象 - fangzhenClient = new ClientSocket(socket, OpenClientSocketEnum.客户端); - //开启异步接收 - fangzhenClient.BeginRecv(); - if (action != null) - { - action(true); - } - } - else - { - if (action != null) - { - action(false); - } - else - { - UnityEngine.Debug.Log("连接仿真服务器失败,重新连接"); - ConnectFangZhenSocekt(serverIP, port); - } - } - } - catch(Exception e) - { - UnityEngine.Debug.Log("连接仿真服务器失败,请重试:"+e.Message); - if (action != null) - { - action(false); - } - } - } - } - /// - /// 关闭仿真服务器客户端 - /// - public static void CloseFangZhenSocket() - { - if (fangzhenClient != null) - { - fangzhenClient.threadRun = false; - if (fangzhenClient.socket.Connected) - { - fangzhenClient.socket.Shutdown(SocketShutdown.Both); - } - fangzhenClient.socket.Close(); - fangzhenClient = null; - UnityEngine.Debug.Log("关闭仿真服务客户端socket成功"); - } - } - - - public static void SendToTongBuFangZhenServerByAllUser(MessageModel message) - { - if (fangzhenClient != null) - { - if (fangzhenClient.socket.Connected) - { - fangzhenClient.ReadySend(message); - } - else - { - ConnectFangZhenSocekt(LoadManage.Instance.currentPractice.IpAddress, LoadManage.Instance.currentPractice.Port.Value, (a) => - { - if(a) - { - fangzhenClient.ReadySend(message); - } - else - { - UnityEngine.Debug.Log("连接失败"); - } - }); - } - } - else - { - try - { - UnityEngine.Debug.Log("正在连接仿真服务器中。。。。"); - Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - socket.Connect(IPAddress.Parse(LoadManage.Instance.currentPractice.IpAddress), LoadManage.Instance.currentPractice.Port.Value); - if (socket.Connected) - { - UnityEngine.Debug.Log("连接成功"); - //创建客户端对象 - fangzhenClient = new ClientSocket(socket, OpenClientSocketEnum.客户端); - //开启异步接收 - fangzhenClient.BeginRecv(); - fangzhenClient.ReadySend(message); - } - } - catch - { - UnityEngine.Debug.Log("连接仿真服务器失败,请重试"); - } - } - } - /// - /// 发送同步数据给仿真服务器 - /// - /// 发送的消息 - /// 返回的字符串 - public static void SendToTongBuFangZhenServer(MessageModel message) - { - if (fangzhenClient != null && fangzhenClient.socket.Connected) - { - fangzhenClient.ReadySend(message); - //UnityEngine.Debug.Log("发送的同步消息内容:__________ " + message.str); - } - else - { - try - { - UnityEngine.Debug.Log("正在连接仿真服务器中。。。。"); - Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - socket.Connect(IPAddress.Parse(LoadManage.Instance.currentPractice.IpAddress), LoadManage.Instance.currentPractice.Port.Value); - if (socket.Connected) - { - UnityEngine.Debug.Log("连接成功"); - //创建客户端对象 - fangzhenClient = new ClientSocket(socket, OpenClientSocketEnum.客户端); - //开启异步接收 - fangzhenClient.BeginRecv(); - fangzhenClient.ReadySend(message); - //UnityEngine.Debug.Log("发送的同步消息内容:__________ " + message.str); - } - } - catch - { - UnityEngine.Debug.Log("连接仿真服务器失败,请重试"); - } - } - } - /// - /// 发送命令给仿真服务器 - /// - /// - public static void SendCommondToFangZhenServer(MessageModel message) - { - if (fangzhenClient != null && fangzhenClient.socket.Connected) - { - fangzhenClient.ReadySend(message); - } - else - { - try - { - UnityEngine.Debug.Log("正在连接仿真服务器中。。。。"); - Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - socket.Connect(IPAddress.Parse(LoadManage.Instance.currentPractice.IpAddress), LoadManage.Instance.currentPractice.Port.Value); - if (socket.Connected) - { - UnityEngine.Debug.Log("连接成功"); - //创建客户端对象 - fangzhenClient = new ClientSocket(socket, OpenClientSocketEnum.客户端); - //开启异步接收 - fangzhenClient.BeginRecv(); - fangzhenClient.ReadySend(message); - } - } - catch - { - UnityEngine.Debug.Log("连接仿真服务器失败,请重试"); - } - } - } - - /// - /// 发送指挥给仿真服务器 - /// - /// 发送的消息 - /// 返回的字符串 - public static void SendZhiHuiToFangZhenServer(MessageModel message, Action callback) - { - if (fangzhenClient != null && fangzhenClient.socket.Connected) - { - fangzhenClient.zhiHuiCallBack = callback; - fangzhenClient.ReadySend(message); - } - } - - /// - /// 同步设备字典 - /// - /// - /// - public static void DevicesSyncByDic(string deviceId,string content) - { - MessageModel message = new MessageModel(SimOperationEnum.数据同步客户端); - message.str = "设备属性按字典同步字典"; - message.canShu = deviceId +"$"+ content; - if (fangzhenClient != null && fangzhenClient.socket.Connected) - { - fangzhenClient.ReadySend(message); - } - } - #endregion -} diff --git a/Assets/Zion/Scripts/Socket/ClientSocket.cs.meta b/Assets/Zion/Scripts/Socket/ClientSocket.cs.meta deleted file mode 100644 index 90f1e7eb..00000000 --- a/Assets/Zion/Scripts/Socket/ClientSocket.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 689baea31e156a4458510b83acbc13ac -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Socket/MessageModel.cs b/Assets/Zion/Scripts/Socket/MessageModel.cs deleted file mode 100644 index 48d8b217..00000000 --- a/Assets/Zion/Scripts/Socket/MessageModel.cs +++ /dev/null @@ -1,67 +0,0 @@ -/// -/// 协同交互服务操作类型 -/// -public enum SimOperationEnum -{ - EXE开启 , - EXE开启收到 , - EXE开启完成 , - EXE关闭客户端 , - ExE关闭服务端, - EXE关闭收到 , - EXE关闭完成 , - 环境配置客户端, - 环境配置服务端, - 语音客户端, - 语音服务端, - 数据同步客户端, - 数据同步服务端, - 指挥指令客户端, - 指挥指令服务端, - 步骤完成客户端, - 步骤完成服务端, - Commond客户端, - Commond服务端, - 科目启停客户端, - 科目启停服务端, - 目标故障客户端, - 目标故障服务端, - 科目切换客户端, - 科目切换服务端, - 时统客户端, - 时统服务端, - 暂停继续客户端, - 暂停继续服务端, - 操作软件三维端, - 操作软件服务端, - 操作软件二维端, - 流程反馈服务端 -} -public class MessageModel -{ - public SimOperationEnum operationEnum;//操作方式(不能为0) - public object canShu; - public int port; - public string str; - public float floatData; - public string str2; - - public MessageModel(SimOperationEnum operationEnum, object canShu) - { - this.operationEnum = operationEnum; - this.canShu = canShu; - } - public MessageModel(SimOperationEnum operationEnum) - { - this.operationEnum = operationEnum; - } - public MessageModel(SimOperationEnum operationEnum, int port) - { - this.operationEnum = operationEnum; - this.port = port; - } - public MessageModel() - { - - } -} diff --git a/Assets/Zion/Scripts/Socket/MessageModel.cs.meta b/Assets/Zion/Scripts/Socket/MessageModel.cs.meta deleted file mode 100644 index 82a86d25..00000000 --- a/Assets/Zion/Scripts/Socket/MessageModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 439bc84f09e4815438c689e86de5a4ca -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1.meta b/Assets/Zion/Scripts/Sync1.meta deleted file mode 100644 index 6abfea75..00000000 --- a/Assets/Zion/Scripts/Sync1.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: edaaf0d27d87ce64c8c4d285659bb33e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs deleted file mode 100644 index 74c4ed29..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class FunctionSync_Active : OneValueSyncObject -{ - public void Init() - { - if (!hasInit) - { - InitDynamic("active_" + gameObject.name, CallBack, ValueType.Bool); - } - } - - /// - /// 显示物体 - /// - public void ShowObject() - { - gameObject.SetActive(true); - mybool = true; - SendSync(); - } - /// - /// 隐藏物体 - /// - public void DisShowObject() - { - gameObject.SetActive(false); - mybool = false; - SendSync(); - } - - /// - /// 回调 - /// - /// - public void CallBack(string id,bool isEnterRoom) - { - if(mybool) - { - gameObject.SetActive(true); - } - else - { - gameObject.SetActive(false); - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs.meta deleted file mode 100644 index 5c349817..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Active.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d87d349b2a4c38146bb6702b8307a902 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs deleted file mode 100644 index 996c4280..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// -/// 注意:尽量用协程代替动画,直接用动画同步会出现各客户端动画播放不一致的情况。 -/// -public class FunctionSync_Animator : OneValueSyncObject -{ - Animator anim; - List state = new List(); - string currentTriger; - private void Start() - { - Init(); - } - - public void Init() - { - if (!hasInit) - { - anim = GetComponent(); - InitDynamic("animator" + gameObject.name, CallBack, ValueType.String); - } - } - - public void SetAnimatorState(string TriggerParameter) - { - if (!state.Contains(mystring)) - { - state.Add(mystring); - } - currentTriger = mystring; - - anim.SetTrigger(TriggerParameter); - mystring = TriggerParameter; - SendSync(); - } - - /// - /// 回调 - /// - /// - private void CallBack(string id,bool isEnterRoom) - { - if(!state.Contains(mystring)) - { - state.Add(mystring); - currentTriger = mystring; - anim.SetTrigger(mystring); - Debug.Log("动画同步:" + id + "," + mystring); - } - else - { - if (currentTriger!=mystring) - { - currentTriger = mystring; - anim.SetTrigger(mystring); - Debug.Log("动画同步:" + id + "," + mystring); - } - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs.meta deleted file mode 100644 index 17f3b25b..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Animator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e97790970474bcc47a6beff0dfbe8570 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs deleted file mode 100644 index b1e541cb..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class FunctionSync_Audio : OneValueSyncObject -{ - private AudioSource audioSource; - - public bool 重进房间是否播放; - - public void Init() - { - if (!hasInit) - { - audioSource = GetComponent(); - InitDynamic("audio_" + gameObject.name, CallBack, ValueType.Int); - } - } - - /// - /// 操作同步声音 - /// - /// - public void SetAudio(AudioControlEnum audioControlEnum) - { - myint = (int)audioControlEnum; - switch (audioControlEnum) - { - case AudioControlEnum.Play: - audioSource.Play(); - break; - case AudioControlEnum.Pause: - audioSource.Pause(); - break; - case AudioControlEnum.Stop: - audioSource.Stop(); - break; - } - SendSync(); - } - private void CallBack(string callback,bool isjoinRoom) - { - if(isjoinRoom && !重进房间是否播放) - { - return; - } - - switch ((AudioControlEnum)myint) - { - case AudioControlEnum.Play: - audioSource.Play(); - break; - case AudioControlEnum.Pause: - audioSource.Pause(); - break; - case AudioControlEnum.Stop: - audioSource.Stop(); - break; - } - } -} - -/// -/// 声音操作枚举 -/// -public enum AudioControlEnum -{ - NULL, - Play, - Pause, - Stop -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs.meta deleted file mode 100644 index bd2911f0..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Audio.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b53f3d994ae112749b54a98b2d818302 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs deleted file mode 100644 index 714bcbfd..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System; -using System.Text; - -/// -/// 生成物体同步,是单例 -/// -public class FunctionSync_CreateObejct : MonoBehaviour -{ - public static FunctionSync_CreateObejct Instance; - private st_Motions st = new st_Motions { m_iOperaType = 10008 }; - public static Dictionary createDic = new Dictionary(); - private bool hasInit; - void Start() - { - Init(); - } - - /// - /// 初始化 - /// - /// - public void Init() - { - if (!GameManage.Instance.is单机模式) - { - if (!hasInit) - { - Instance = this; - st.area = LoadManage.Instance.currentRoomArea; - //发送数据 - List tmpbytes = new List(); - //syncId - tmpbytes.AddRange(BitConverter.GetBytes(LoadManage.Instance.SyncId)); - //postion,roate,scale - tmpbytes.AddRange(new byte[36]); - //string长度 - tmpbytes.AddRange(new byte[4]); - st.m_sOperaData = tmpbytes.ToArray(); - hasInit = true; - } - } - } - /// - /// 生成物体 - /// - /// Resource - /// position - /// eulerAngles - /// localScale - public void CreateObejct(string path,Vector3 pos,Vector3 roate,Vector3 scale) - { - if (!createDic.ContainsKey(path)) - { - createDic.Add(path, Resources.Load(path)); - } - GameObject obj = Instantiate(createDic[path]); - obj.transform.position = pos; - obj.transform.eulerAngles = roate; - obj.transform.localScale = scale; - SendSync(path, pos, roate, scale); - } - /// - /// 回调 - /// - /// - public void CallBack(byte[] data) - { - Vector3 pos = new Vector3(BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8), BitConverter.ToSingle(data, 12)); - Vector3 roate = new Vector3(BitConverter.ToSingle(data, 16), BitConverter.ToSingle(data, 20), BitConverter.ToSingle(data, 24)); - Vector3 scale = new Vector3(BitConverter.ToSingle(data, 28), BitConverter.ToSingle(data, 32), BitConverter.ToSingle(data, 36)); - int legth = BitConverter.ToInt32(data, 40); - string path = Encoding.UTF8.GetString(data, 44,legth); - if (!createDic.ContainsKey(path)) - { - createDic.Add(path, Resources.Load(path)); - } - GameObject obj = Instantiate(createDic[path]); - obj.transform.position = pos; - obj.transform.eulerAngles = roate; - obj.transform.localScale = scale; - } - - private void SendSync(string path, Vector3 pos, Vector3 roate, Vector3 scale) - { - byte[] strs=Encoding.UTF8.GetBytes(path); - byte[] data = new byte[strs.Length + 44]; - //sysid - Array.Copy(st.m_sOperaData, 0, data, 0, 4); - //pos - Array.Copy(BitConverter.GetBytes(pos.x), 0, data, 4, 4); - Array.Copy(BitConverter.GetBytes(pos.y), 0, data, 8, 4); - Array.Copy(BitConverter.GetBytes(pos.z), 0, data, 12, 4); - //roate - Array.Copy(BitConverter.GetBytes(roate.x), 0, data, 16, 4); - Array.Copy(BitConverter.GetBytes(roate.y), 0, data, 20, 4); - Array.Copy(BitConverter.GetBytes(roate.z), 0, data, 24, 4); - //scale - Array.Copy(BitConverter.GetBytes(scale.x), 0, data, 28, 4); - Array.Copy(BitConverter.GetBytes(scale.y), 0, data, 32, 4); - Array.Copy(BitConverter.GetBytes(scale.z), 0, data, 36, 4); - //string长度 - Array.Copy(BitConverter.GetBytes(strs.Length), 0, data, 40, 4); - //string - Array.Copy(strs, 0, data, 44, strs.Length); - st.m_sOperaData = data; - LoadManage.Instance.RSclient.Send(st); - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs.meta deleted file mode 100644 index 10cf7059..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_CreateObejct.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dcdb571f478b1b84ea88f914db0c8e1e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs deleted file mode 100644 index 1af3ca80..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class FunctionSync_Material : OneValueSyncObject -{ - Renderer renderer; - - /// - /// MeshRender上材质球索引 - /// - public int materialIndex = 0; - Dictionary matDic = new Dictionary(); - - private void Start() - { - Init(); - } - - public void Init() - { - if (!hasInit) - { - renderer = GetComponent(); - InitDynamic("Material_" + gameObject.name, CallBack, ValueType.String); - } - } - /// - /// 设置材质 - /// - /// Resource文件下加载路径 - public void SetMaterial(string ResourcePath) - { - if(!matDic.ContainsKey(ResourcePath)) - { - Material m = Resources.Load(ResourcePath); - matDic.Add(ResourcePath, m); - } - renderer.materials[materialIndex].CopyPropertiesFromMaterial(matDic[ResourcePath]); - mystring = ResourcePath; - SendSync(); - } - - - /// - /// 回调 - /// - /// - public void CallBack(string id, bool isEnterRoom) - { - if (!matDic.ContainsKey(mystring)) - { - Material m = Resources.Load(mystring); - matDic.Add(mystring, m); - } - renderer.materials[materialIndex].CopyPropertiesFromMaterial(matDic[mystring]); - } -} - diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs.meta deleted file mode 100644 index 5776cd99..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Material.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 703a02f3fc117284ea7c17d003f734de -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs deleted file mode 100644 index 6d7ba216..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System; - -public class FunctionSync_MaterialTexture : OneValueSyncObject -{ - Renderer renderer; - - Dictionary matDic = new Dictionary(); - - private void Start() - { - Init(); - } - - public void Init() - { - if (!hasInit) - { - renderer = GetComponent(); - InitDynamic("MaterialTex_" + gameObject.name, CallBack, ValueType.Int); - } - } - /// - /// 设置材质 - /// - /// Resource文件下加载路径 - public void SetMaterial(int num) - { - if(num<0) - { - return; - } - else if(num>0) - { - - } - - myint = num; - SendSync(); - if (num == 0) - { - //关闭 - renderer.material.mainTexture = null; - } - else - { - if (!matDic.ContainsKey(num)) - { - //StartCoroutine(GetTexture(num, MediaPanel.instance.dicPicture[num].url, a => - //{ - // if (a) - // { - // renderer.material.mainTexture = matDic[num]; - // } - // else - // { - // Debug.LogError("下载图片失败:" + num); - // } - //})); - } - else - { - renderer.material.mainTexture = matDic[num]; - } - } - } - /// - /// 下载图片 - /// - /// - IEnumerator GetTexture(int num, string url1, Action callback) - { - WWW www1 = new WWW(url1); - yield return www1; - if (www1.isDone) - { - if (!string.IsNullOrEmpty(www1.error)) - { - Debug.LogError(www1.error); - MessagePanel.ShowMessage("获取图片失败:" + www1.error, GameObject.Find("Canvas").transform, a => { }); - callback.Invoke(false); - } - else - { - Debug.Log("下载图片成功:" + num); - matDic.Add(num, www1.texture); - callback.Invoke(true); - } - } - } - - /// - /// 回调 - /// - /// - public void CallBack(string id, bool isEnterRoom) - { - if (myint == 0) - { - renderer.material.mainTexture = null; - } - else if (!matDic.ContainsKey(myint)) - { - //StartCoroutine(GetTexture(myint, MediaPanel.instance.dicPicture[myint].url, a => - //{ - // if (a) - // { - // renderer.material.mainTexture = matDic[myint]; - // } - // else - // { - // Debug.LogError("下载图片失败:" + myint); - // } - //})); - } - else - { - renderer.material.mainTexture = matDic[myint]; - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs.meta deleted file mode 100644 index 6d58ffe4..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_MaterialTexture.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 60c58dc1d14e27244b9adf0fd99f1294 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs deleted file mode 100644 index ae7af012..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs +++ /dev/null @@ -1,254 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Video; -using System.Text; -using System; - -/// -/// 多媒体同步,适用于图片,ppt,视频集成在一个材质上 -/// -public class FunctionSync_Media : MonoBehaviour -{ - public static Dictionary functionSync_MediaDic = new Dictionary(); - - /// - /// type,编号,如果为ppt,索引 - /// - public string Id; - private VideoPlayer videoPlayer; - private Renderer renderer; - - /// - /// 关闭的texture - /// - private Texture nullTexture; - - /// - /// 当前视频播放时间 - /// - [HideInInspector] - public double PlayTime; - - private int currentTextureNum; - private int currentPPTnum; - [HideInInspector] - public int currentPPTsubNum; - private int currentVideoNum; - [HideInInspector] - public byte videoState; - - /// - /// id流 - /// - private byte[] idbytes; - public void Init() - { - renderer = GetComponent(); - videoPlayer = GetComponent(); - nullTexture = renderer.material.mainTexture; - Id = "media_" + gameObject.name; - idbytes = Encoding.UTF8.GetBytes(Id); - functionSync_MediaDic.Add(Id, this); - } - - float time = 0; - private void Update() - { - //学生回拉,老师不在视频不播放 - if (!GameManage.Instance.is单机模式) - { - //if (!LoadManage.Instance.loadPackage.isOwner) - //{ - // if (videoPlayer.isPlaying && videoPlayer.time > PlayTime + 1) - // { - // videoPlayer.time = PlayTime + 1; - // } - //} - //else - { - if (videoPlayer.isPlaying && videoState==1) - { - time += Time.deltaTime; - if (time > 1) - { - time = 0; - PlayTime = videoPlayer.time; - //发送时间 - SetVideo(currentVideoNum, 1, PlayTime); - } - } - } - } - } - - public void SetTexture(int num) - { - List tmp = new List(); - //id - tmp.AddRange(BitConverter.GetBytes(idbytes.Length)); - tmp.AddRange(idbytes); - //图片 - tmp.Add(0); - tmp.AddRange(BitConverter.GetBytes(num)); - LoadManage.Instance.RSclient.Send(LoadManage.Instance.currentRoomArea, 10010, tmp.ToArray()); - } - public void SetPPT(int num,int index) - { - List tmp = new List(); - //id - tmp.AddRange(BitConverter.GetBytes(idbytes.Length)); - tmp.AddRange(idbytes); - //ppt - tmp.Add(2); - tmp.AddRange(BitConverter.GetBytes(num)); - tmp.AddRange(BitConverter.GetBytes(index)); - LoadManage.Instance.RSclient.Send(LoadManage.Instance.currentRoomArea, 10010, tmp.ToArray()); - } - public void SetVideo(int num,byte isOpen,double playtime) - { - List tmp = new List(); - //id - tmp.AddRange(BitConverter.GetBytes(idbytes.Length)); - tmp.AddRange(idbytes); - //视频 - tmp.Add(1); - tmp.AddRange(BitConverter.GetBytes(num)); - tmp.Add(isOpen); - tmp.AddRange(BitConverter.GetBytes(playtime)); - LoadManage.Instance.RSclient.Send(LoadManage.Instance.currentRoomArea, 10010, tmp.ToArray()); - } - - public void CallBack(byte[] data,bool isJoinRoom=false) - { - int num=BitConverter.ToInt32(data,1+4+idbytes.Length); - if (data[4 + idbytes.Length] == 0) - { - currentTextureNum = num; - //type,num - //图片 - videoPlayer.Stop(); - //下载 - //StartCoroutine(GetTexture(MediaPanel.instance.dicPicture[num].url, (a,tex) => - //{ - // if (a) - // { - // renderer.material.mainTexture = tex; - // } - // else - // { - // Debug.LogError("下载图片失败:" + num); - // } - //})); - } - else if(data[4 + idbytes.Length] == 1) - { - currentVideoNum = num; - videoState = data[5+4+idbytes.Length]; - //if (videoPlayer.url != MediaPanel.instance.dicVideo[num].url) - //{ - // videoPlayer.url = MediaPanel.instance.dicVideo[num].url; - //} - //type,num,开关,播放时间 - //视频 - if (data[5 + 4 + idbytes.Length] ==0) - { - //关闭 - videoPlayer.Stop(); - PlayTime = 0; - } - else if(data[5 + 4 + idbytes.Length] ==1) - { - //开启 - videoPlayer.playbackSpeed = 1; - if (!videoPlayer.isPlaying) - { - videoPlayer.Play(); - } - PlayTime = videoPlayer.time; - } - else if(data[5 + 4 + idbytes.Length] ==2) - { - //暂停 - videoPlayer.playbackSpeed = 0; - PlayTime = videoPlayer.time; - } - - if (isJoinRoom) - { - videoPlayer.time = BitConverter.ToDouble(data, 6 + 4 + idbytes.Length); - } - else - { - //if (!LoadManage.Instance.loadPackage.isOwner) - //{ - // videoPlayer.time = BitConverter.ToDouble(data, 6 + 4 + idbytes.Length); - //} - } - } - else if(data[4 + idbytes.Length] == 2) - { - currentPPTnum = num; - //type,num,索引 - //PPT - int index = BitConverter.ToInt32(data,5 + 4 + idbytes.Length); - currentPPTsubNum = index; - videoPlayer.Stop(); - - if (index < 0) - { - //关闭ppt - renderer.material.mainTexture = nullTexture; - } - else - { - //无索引 - //下载 - //StartCoroutine(GetTexture(MediaPanel.instance.dicPPT[num].subTextures[index], (a, tex) => - //{ - // if (a) - // { - // //pptTexDic[num].ppttextureDic.Add(index, tex); - // renderer.material.mainTexture = tex; - // } - // else - // { - // Debug.LogError("下载PPT图片失败:" + num); - // } - //})); - } - } - } - - /// - /// 下载图片 - /// - /// - IEnumerator GetTexture(string url1, Action callback) - { - WWW www1 = new WWW(url1); - yield return www1; - if (www1.isDone) - { - if (!string.IsNullOrEmpty(www1.error)) - { - Debug.LogError(www1.error); - MessagePanel.ShowMessage("获取图片失败:" + www1.error, GameObject.Find("Canvas").transform, a => { }); - callback.Invoke(false,null); - } - else - { - Debug.Log("下载图片成功"); - callback.Invoke(true,www1.texture); - } - } - } -} - -/// -/// ppt信息 -/// -public class PPTtextureDate -{ - public Dictionary ppttextureDic = new Dictionary(); -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs.meta deleted file mode 100644 index 51f84865..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Media.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7f2350bc421efea4a93328a98aafc0b2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs deleted file mode 100644 index 56d90353..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System; - -public class FunctionSync_Parent : OneValueSyncObject -{ - /// - /// 是否为父物体 - /// - public bool isParent; - - private OneValueSyncObject localposSync; - private OneValueSyncObject localangSync; - - private void Start() - { - Init(); - } - - public void Init() - { - if(!hasInit) - { - InitDynamic("parent_" + gameObject.name, CallBackParent, ValueType.String); - if (!isParent) - { - localposSync = gameObject.AddComponent(); - localposSync.InitDynamic(Id + "pos", CallBackPos, ValueType.Vector3); - localangSync = gameObject.AddComponent(); - localangSync.InitDynamic(Id + "ang", CallBackAng, ValueType.Vector3); - } - } - } - /// - /// 设置父物体 - /// - /// - /// - /// - public void SetParent(FunctionSync_Parent parent, Vector3 Localpos,Vector3 LocalEulerAngles) - { - if(!isParent) - { - transform.parent = parent.transform; - transform.localPosition = Localpos; - transform.localEulerAngles = LocalEulerAngles; - - mystring = parent.Id; - SendSync(); - SetLocalPos(Localpos); - SetLocalAng(LocalEulerAngles); - } - else - { - Debug.LogError("父物体不能再设置父物体"); - } - } - /// - /// 设置局部坐标 - /// - public void SetLocalPos(Vector3 localpos) - { - localposSync.myvector3 = localpos; - localposSync.SendSync(); - } - /// - /// 设置局部旋转 - /// - public void SetLocalAng(Vector3 localang) - { - localangSync.myvector3 = localang; - localangSync.SendSync(); - } - - private void CallBackParent(string id, bool isEnterRoom) - { - if (!isParent) - { - transform.parent = OneValueSyncObject.OneAxisSyncObjectList[mystring].transform; - } - } - private void CallBackPos(string id, bool isEnterRoom) - { - if (!isParent) - { - transform.localPosition = localposSync.myvector3; - } - } - private void CallBackAng(string id, bool isEnterRoom) - { - if (!isParent) - { - transform.localEulerAngles = localangSync.myvector3; - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs.meta deleted file mode 100644 index 1710f12b..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Parent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e73d48c6e85b7ed40ae3ca2c88f64ffb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs deleted file mode 100644 index ea159588..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class FunctionSync_ParticleSystem : OneValueSyncObject -{ - ParticleSystem ps; - - private void Start() - { - Init(); - } - - public void Init() - { - if(!hasInit) - { - ps = GetComponent(); - if (ps != null) - { - InitDynamic("ps_" + gameObject.name, CallBack, ValueType.Int); - } - } - } - /// - /// 操作粒子 - /// - /// - public void SetParticleSystem(ParticleSystemState state) - { - myint = (int)state; - switch (state) - { - case ParticleSystemState.Play: - ps.Play(); - break; - case ParticleSystemState.Stop: - ps.Stop(); - break; - case ParticleSystemState.Pause: - ps.Pause(); - break; - } - SendSync(); - } - private void CallBack(string id, bool isEnterRoom) - { - switch ((ParticleSystemState)myint) - { - case ParticleSystemState.Play: - ps.Play(); - break; - case ParticleSystemState.Stop: - ps.Stop(); - break; - case ParticleSystemState.Pause: - ps.Pause(); - break; - } - } -} -/// -/// 粒子操作枚举 -/// -public enum ParticleSystemState -{ - Null, - Play, - Stop, - Pause -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs.meta deleted file mode 100644 index 55771636..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_ParticleSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8e9990bb948d68d44b43ba99602d723e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs deleted file mode 100644 index 9e40319c..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs +++ /dev/null @@ -1,430 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using UnityEngine; - -/// -/// 注意:1.此脚本和动画共用时,需要注意动画激活时,位置会被锁死,无法移动。 -/// 2.有控制权才能移动,结束后需释放控制权(控制权专属除外) -/// -public class FunctionSync_PositionRoate : SyncBase -{ - public static Dictionary positionRoateSyncObejctList = new Dictionary(); - [Tooltip("同步坐标")] - public bool isPositionSync; - [HideInInspector] - public bool isLocalPotion=true; - [Tooltip("同步角度")] - public bool isRoateSync; - [HideInInspector] - public bool isLocalRoate=true; - /// - /// 是否本地锁定 - /// - [DisplayOnly] - public bool isLock=true; - - //同步的位置 - [DisplayOnly] - public float[] pos = new float[6]; - private Vector3 tmpPos = new Vector3(); - private Vector3 tmpRat = new Vector3(); - - private st_Motions st_Motions = new st_Motions { m_iOperaType = 10007 }; - private int lastindex; - - - private void OnDestroy() - { - if(positionRoateSyncObejctList.ContainsKey(Id)) - { - positionRoateSyncObejctList.Remove(Id); - } - } - public void Init() - { - if (!hasInit) - { - if (!positionRoateSyncObejctList.ContainsValue(this)) - { - InitDynamic("move_" + gameObject.name); - } - } - } - /// - /// 初始化 - /// - /// - /// 是否获取控制权 - public void InitDynamic(string id,bool isControl=false) - { - if (GameManage.Instance.is单机模式) - { - return; - } - - if (hasInit) - { - Debug.Log("已经初始化,不能重复初始化"); - return; - } - - if (string.IsNullOrEmpty(id)) - { - if (string.IsNullOrEmpty(Id)) - { - Debug.LogError("Id为空"); - return; - } - } - else - { - Id = id; - } - - if (LoadManage.Instance != null) - { - st_Motions.area = LoadManage.Instance.currentRoomArea; - } - isLock = !isControl; - //初始化缓存 - if(isPositionSync) - { - lastpos = isLocalPotion ? transform.localPosition : transform.position; - } - if(isRoateSync) - { - lastrot = isLocalRoate ? transform.localEulerAngles : transform.eulerAngles; - } - List tmpbytes = new List(); - //syncId - if (LoadManage.Instance != null) - { - tmpbytes.AddRange(BitConverter.GetBytes(LoadManage.Instance.SyncId)); - } - //id - byte[] data = Encoding.UTF8.GetBytes(Id); - tmpbytes.AddRange(BitConverter.GetBytes(data.Length)); - tmpbytes.AddRange(data); - //类型 - if(isPositionSync&& !isRoateSync) - { - tmpbytes.Add(0); - lastindex = tmpbytes.Count; - //坐标系 - tmpbytes.Add(isLocalPotion ? (byte)1 : (byte)0); - tmpbytes.AddRange(new byte[12]); - } - else if(!isPositionSync && isRoateSync) - { - tmpbytes.Add(1); - lastindex = tmpbytes.Count; - //坐标系 - tmpbytes.Add(isLocalRoate ? (byte)1 : (byte)0); - tmpbytes.AddRange(new byte[12]); - } - else if(isPositionSync && isRoateSync) - { - tmpbytes.Add(2); - lastindex = tmpbytes.Count; - //坐标系 - tmpbytes.Add(isLocalPotion ? (byte)1 : (byte)0); - tmpbytes.AddRange(new byte[12]); - tmpbytes.Add(isLocalRoate ? (byte)1 : (byte)0); - tmpbytes.AddRange(new byte[12]); - } - else - { - tmpbytes.Add(3); - lastindex = tmpbytes.Count; - //坐标系 - tmpbytes.Add(isLocalPotion ? (byte)1 : (byte)0); - tmpbytes.AddRange(new byte[12]); - tmpbytes.Add(isLocalRoate ? (byte)1 : (byte)0); - tmpbytes.AddRange(new byte[12]); - } - - //初始化 - pos[0] = isLocalPotion ? transform.localPosition.x : transform.position.x; - pos[1] = isLocalPotion ? transform.localPosition.y : transform.position.y; - pos[2] = isLocalPotion ? transform.localPosition.z : transform.position.z; - pos[3] = isLocalPotion ? transform.localEulerAngles.x : transform.eulerAngles.x; - pos[4] = isLocalPotion ? transform.localEulerAngles.y : transform.eulerAngles.y; - pos[5] = isLocalPotion ? transform.localEulerAngles.z : transform.eulerAngles.z; - st_Motions.m_sOperaData = tmpbytes.ToArray(); - positionRoateSyncObejctList.Add(Id, this); - - hasInit = true; - } - - /// - /// 获取控制权 - /// - public void GetControl() - { - isLock = false; - Debug.Log("获取控制权:" + Id); - } - /// - /// 释放控制权 - /// - public void ReleaseControl() - { - isLock = true; - SendSync(); - Debug.Log("释放控制权:" + Id); - } - - [DisplayOnly] - public float PostionOnceTime = 0.06f; - [DisplayOnly] - public float RoateOneTime = 1; - Vector3 lastpos = new Vector3(); - Vector3 lastrot = new Vector3(); - public virtual void LateUpdate() - { - if (!GameManage.Instance.is单机模式) - { - //发同步 - if (!isLock) - { - bool isAlreadySend = false; - if (isPositionSync) - { - if (isLocalPotion) - { - if (Vector3.Distance(lastpos, transform.localPosition) >= PostionOnceTime) - { - SendSync(); - isAlreadySend = true; - } - } - else - { - if (Vector3.Distance(lastpos, transform.position) >= PostionOnceTime) - { - if (!isLock) - { - SendSync(); - isAlreadySend = true; - } - } - } - } - //位置没法同步时判断角度是否发 - if (isRoateSync && !isAlreadySend) - { - if (isLocalRoate) - { - if (Vector3.Distance(lastrot, transform.localEulerAngles) >= RoateOneTime) - { - SendSync(); - } - } - else - { - if (Vector3.Distance(lastrot, transform.eulerAngles) >= RoateOneTime) - { - SendSync(); - } - } - } - } - else - { - //锁定位置 - if (isPositionSync) - { - tmpPos.x = pos[0]; - tmpPos.y = pos[1]; - tmpPos.z = pos[2]; - if (!isLocalPotion) - { - transform.position = tmpPos; - lastpos = transform.position; - } - else - { - transform.localPosition = tmpPos; - lastpos = transform.localPosition; - } - } - if (isRoateSync) - { - tmpRat.x = pos[3]; - tmpRat.y = pos[4]; - tmpRat.z = pos[5]; - if (!isLocalRoate) - { - transform.eulerAngles = tmpRat; - lastrot = transform.eulerAngles; - } - else - { - transform.localEulerAngles = tmpRat; - lastrot = transform.localEulerAngles; - } - } - } - } - } - public void SendSync() - { - if (!GameManage.Instance.is单机模式) - { - if (isPositionSync) - { - Vector3 tmp; - if (isLocalPotion) - { - tmp = transform.localPosition; - lastpos = transform.localPosition; - } - else - { - tmp = transform.position; - lastpos = transform.position; - } - SetPos(isLocalPotion, tmp.x, tmp.y, tmp.z); - } - - if (isRoateSync) - { - Vector3 tmp; - if (isLocalRoate) - { - tmp = transform.localEulerAngles; - lastrot = transform.localEulerAngles; - } - else - { - tmp = transform.eulerAngles; - lastrot = transform.eulerAngles; - } - SetRot(isLocalRoate, tmp.x, tmp.y, tmp.z); - } - - - if (isPositionSync && !isRoateSync) - { - st_Motions.m_sOperaData[lastindex] = (isLocalPotion ? (byte)1 : (byte)0); - Array.Copy(BitConverter.GetBytes(pos[0]), 0, st_Motions.m_sOperaData, lastindex + 1, 4); - Array.Copy(BitConverter.GetBytes(pos[1]), 0, st_Motions.m_sOperaData, lastindex + 5, 4); - Array.Copy(BitConverter.GetBytes(pos[2]), 0, st_Motions.m_sOperaData, lastindex + 9, 4); - } - else if (!isPositionSync && isRoateSync) - { - st_Motions.m_sOperaData[lastindex] = (isLocalRoate ? (byte)1 : (byte)0); - Array.Copy(BitConverter.GetBytes(pos[3]), 0, st_Motions.m_sOperaData, lastindex + 1, 4); - Array.Copy(BitConverter.GetBytes(pos[4]), 0, st_Motions.m_sOperaData, lastindex + 5, 4); - Array.Copy(BitConverter.GetBytes(pos[5]), 0, st_Motions.m_sOperaData, lastindex + 9, 4); - } - else if (isPositionSync && isRoateSync) - { - st_Motions.m_sOperaData[lastindex] = (isLocalPotion ? (byte)1 : (byte)0); - Array.Copy(BitConverter.GetBytes(pos[0]), 0, st_Motions.m_sOperaData, lastindex + 1, 4); - Array.Copy(BitConverter.GetBytes(pos[1]), 0, st_Motions.m_sOperaData, lastindex + 5, 4); - Array.Copy(BitConverter.GetBytes(pos[2]), 0, st_Motions.m_sOperaData, lastindex + 9, 4); - st_Motions.m_sOperaData[lastindex + 13] = (isLocalPotion ? (byte)1 : (byte)0); - Array.Copy(BitConverter.GetBytes(pos[3]), 0, st_Motions.m_sOperaData, lastindex + 14, 4); - Array.Copy(BitConverter.GetBytes(pos[4]), 0, st_Motions.m_sOperaData, lastindex + 18, 4); - Array.Copy(BitConverter.GetBytes(pos[5]), 0, st_Motions.m_sOperaData, lastindex + 22, 4); - } - LoadManage.Instance.RSclient.Send(st_Motions); - } - } - - public void SetPos(bool islocalPos,float x,float y,float z) - { - this.isLocalPotion = islocalPos; - pos[0] = x; - pos[1] = y; - pos[2] = z; - - } - public void SetRot(bool islocalRoate,float x,float y,float z) - { - this.isLocalRoate = islocalRoate; - pos[3] = x; - pos[4] = y; - pos[5] = z; - } - - public void SetValue(int start,byte[] data) - { - if(data[start]==0) - { - //只同步坐标 - if (data[start+1]==1) - { - //local - isLocalPotion = true; - } - else - { - //世界 - isLocalPotion = false; - } - - pos[0] = BitConverter.ToSingle(data, start + 2); - pos[1] = BitConverter.ToSingle(data, start + 6); - pos[2] = BitConverter.ToSingle(data, start + 10); - } - else if(data[start]==1) - { - //只同步角度 - if (data[start + 1] == 1) - { - //local - isLocalRoate = true; - } - else - { - //世界 - isLocalRoate = false; - } - - pos[3] = BitConverter.ToSingle(data, start + 2); - pos[4] = BitConverter.ToSingle(data, start + 6); - pos[5] = BitConverter.ToSingle(data, start + 10); - } - else if(data[start]==2) - { - //同步位置和角度 - if (data[start + 1] == 1) - { - //local - isLocalPotion = true; - } - else - { - //世界 - isLocalPotion = false; - } - pos[0] = BitConverter.ToSingle(data, start + 2); - pos[1] = BitConverter.ToSingle(data, start + 6); - pos[2] = BitConverter.ToSingle(data, start + 10); - - if (data[start + 14] == 1) - { - //local - isLocalRoate = true; - } - else - { - //世界 - isLocalRoate = false; - } - - pos[3] = BitConverter.ToSingle(data, start + 15); - pos[4] = BitConverter.ToSingle(data, start + 19); - pos[5] = BitConverter.ToSingle(data, start + 23); - } - } -} - -public class DisplayOnly : PropertyAttribute -{ - -} \ No newline at end of file diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs.meta deleted file mode 100644 index 6b4f9482..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_PositionRoate.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 97bf24f09ee4e6c40a9da590d36bfb67 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs deleted file mode 100644 index 836e6498..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -/// -/// 注意:1.此脚本和动画共用时,需要注意动画激活时,缩放会被锁死,无法移动。 -/// 2.有控制权才能移动,结束后需释放控制权(控制权专属除外) -/// -public class FunctionSync_Scale : OneValueSyncObject -{ - /// - /// 是否有控制权 - /// - public bool isControl=false; - private void Start() - { - Init(); - } - - public void Init() - { - if(!hasInit) - { - InitDynamic("Scale_" + gameObject.name, null, ValueType.Vector3); - myvector3 = transform.localScale; - } - } - /// - /// 获取控制权 - /// - public void GetControl() - { - isControl = true; - } - /// - /// 释放控制权 - /// - public void ReleaseControl() - { - isControl = false; - myvector3 = transform.localScale; - SendSync(); - } - [DisplayOnly] - public float OnceTime = 0.1f; - private void LateUpdate() - { - if (!GameManage.Instance.is单机模式) - { - if (!isControl) - { - transform.localScale = myvector3; - } - else - { - if (Vector3.Distance(myvector3, transform.localScale) > OnceTime) - { - myvector3 = transform.localScale; - SendSync(); - } - } - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs.meta deleted file mode 100644 index e6d91d74..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Scale.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c8216020d45268146bc855315c01feb1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs deleted file mode 100644 index 24c7fd94..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System; -using UnityEngine.UI; - -public class FunctionSync_Text : OneValueSyncObject -{ - /// - /// 是否自动初始化,不可中途改变 - /// - public bool isAutoInit=true; - Action callback; - Text Text; - - public void Init(Action callback =null) - { - if(isAutoInit) - { - Text = GetComponent(); - if(Text==null) - { - Debug.LogError("错误,自动初始化需找到Text组件"); - return; - } - } - else - { - if (callback != null) - { - this.callback = callback; - } - else - { - Debug.LogError("错误,自己初始化需要传回调"); - return; - } - } - InitDynamic("text_" + gameObject.name, CallBack, ValueType.String); - } - /// - /// 如果是自动初始化,设置并同步字符串 - /// - /// - public void SetText(string message) - { - mystring = message; - if(callback!=null) - { - callback.Invoke(Id, message); - } - SendSync(); - } - private void CallBack(string id, bool isEnterRoom) - { - if(isAutoInit) - { - Text.text = mystring; - } - else - { - if (callback != null) - { - callback(id, mystring); - } - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs.meta deleted file mode 100644 index 06064887..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Text.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 580a665771fcf7d46af23cf9a147feb1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs b/Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs deleted file mode 100644 index 2cb0c398..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Video; -using System.Text; -using System; - -/// -/// 视频播放同步 -/// -public class FunctionSync_Video : MonoBehaviour -{ - public static Dictionary dicVideo = new Dictionary(); - - public string id; - private VideoPlayer videoPlayer; - private st_Motions st = new st_Motions { m_iOperaType = 10009 }; - /// - /// 视频播放器状态 - /// - public int State; - /// - /// 当前视频播放时间 - /// - private double PlayTime; - private bool hasInit; - - private int index; - void Start() - { - Init(); - } - - public void Init() - { - if (!GameManage.Instance.is单机模式) - { - if (!hasInit) - { - st.area = LoadManage.Instance.currentRoomArea; - id = "video_" + gameObject.name; - videoPlayer = GetComponent(); - byte[] idbyte = Encoding.UTF8.GetBytes(id); - byte[] tmp = new byte[4 + 4 + 8 + idbyte.Length]; - index = 4 + idbyte.Length; - //id - Array.Copy(BitConverter.GetBytes(idbyte.Length), 0, tmp, 0, 4); - Array.Copy(idbyte, 0, tmp, 4, idbyte.Length); - //状态 - //时间 - st.m_sOperaData = tmp; - dicVideo.Add(id, this); - hasInit = true; - } - } - } - private void Update() - { - //学生回拉,老师不在视频不播放 - if(!GameManage.Instance.is单机模式 ) - { - if(videoPlayer.isPlaying && videoPlayer.time>PlayTime+1) - { - videoPlayer.time = PlayTime+1; - } - } - } - - /// - /// 操作同步视频 - /// - public void SetAudio(int num) - { - State = num; - if (num == 0) - { - //关闭 - videoPlayer.Stop(); - PlayTime = 0; - } - else if (num == -1) - { - //暂停 - videoPlayer.playbackSpeed=0; - PlayTime = videoPlayer.time; - } - else if (num == -2) - { - //继续 - videoPlayer.playbackSpeed = 1; - PlayTime = videoPlayer.time; - } - else if(num==1) - { - //播放 - videoPlayer.playbackSpeed = 1; - videoPlayer.Play(); - PlayTime = videoPlayer.time; - } - - SendSync(); - } - - /// - /// 回调(老师不执行) - /// - /// - /// - public void CallBack(int state,double time) - { - State = state; - PlayTime = time; - if (State == 0) - { - //关闭 - videoPlayer.Stop(); - } - else if (State == -1) - { - //暂停 - videoPlayer.playbackSpeed = 0; - } - else if(State==1) - { - //播放 - videoPlayer.playbackSpeed = 1; - videoPlayer.Play(); - } - videoPlayer.time = time; - } - - public void JoinRoomCallBack(int state, double time) - { - State = state; - PlayTime = time; - if (State == -1) - { - //暂停 - videoPlayer.Play(); - videoPlayer.playbackSpeed = 1; - videoPlayer.time = time; - videoPlayer.playbackSpeed = 0; - } - else if (State == 1) - { - //播放 - videoPlayer.Play(); - videoPlayer.playbackSpeed = 1; - videoPlayer.time = time; - } - } - - - - /// - /// 更新时间 - /// - /// - public void SetCurrentTime(double time) - { - PlayTime = time; - SendSync(); - } - - private void SendSync() - { - //状态 - Array.Copy(BitConverter.GetBytes(State), 0, st.m_sOperaData, index, 4); - //时间 - Array.Copy(BitConverter.GetBytes(PlayTime), 0, st.m_sOperaData, index + 4, 8); - LoadManage.Instance.RSclient.Send(st); - } -} diff --git a/Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs.meta b/Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs.meta deleted file mode 100644 index f27212cb..00000000 --- a/Assets/Zion/Scripts/Sync1/FunctionSync_Video.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 60ec3eff123f7d843a6532028407035a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/MyPlayer.cs b/Assets/Zion/Scripts/Sync1/MyPlayer.cs deleted file mode 100644 index 3899594b..00000000 --- a/Assets/Zion/Scripts/Sync1/MyPlayer.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using System; - -public class MyPlayer : FunctionSync_PositionRoate -{ - public string id = ""; - public string name = ""; - public TextMesh text; - public GameObject m_carryingIcon; - public MeshRenderer m_carryingIconMeshRenderer; - private float value; - public Animator anim; - public bool isTeacher; - /// - /// 预制体类型 - /// - public byte PrefbType; - public void Init(string id,string name,byte isTeather,byte PrefbType) - { - this.id = id; - this.name = name; - this.PrefbType = PrefbType; - isPositionSync = true; - isRoateSync = true; - //初始化同步 - if (LoadManage.Instance != null) - { - InitDynamic(id, id == LoadManage.Instance.MyId); - } - else - { - InitDynamic(id, true); - } - - //名字 - text =GetComponentInChildren(); - text.text = name; - m_carryingIcon = text.transform.Find("CarryingIcon").gameObject; - m_carryingIconMeshRenderer = m_carryingIcon.GetComponent(); - - - //自己或学生隐藏textmesh - if (LoadManage.Instance == null) - { - text.gameObject.SetActive(false); - } - else - { - if (id == LoadManage.Instance.MyId) - { - text.gameObject.SetActive(false); - } - else - { - text.gameObject.SetActive(true); - } - } - m_carryingIcon.SetActive(isTeacher); - - anim = GetComponent(); - } - - Vector3 lastpos=new Vector3(); - public float OnceTime = 0.06f; - public override void LateUpdate() - { - if (!GameManage.Instance.is单机模式) - { - //发送同步 - if (id == LoadManage.Instance.MyId) - { - if (Vector3.Distance(lastpos, transform.position) >= OnceTime) - { - lastpos = transform.position; - SendSync(); - } - } - else - { - base.LateUpdate(); - } - } - - - if (text != null) - { - text.transform.LookAt(Camera.main.transform); - text.transform.Rotate(Vector3.up, 180, Space.Self); - } - } - /// - /// 立即同步一次 - /// - public void SyncAtOnce() - { - if (id == LoadManage.Instance.MyId) - { - lastpos = transform.position; - SendSync(); - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/MyPlayer.cs.meta b/Assets/Zion/Scripts/Sync1/MyPlayer.cs.meta deleted file mode 100644 index 068a0dcb..00000000 --- a/Assets/Zion/Scripts/Sync1/MyPlayer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 69210b4fce550684aa3e3d3bda7df6b7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/NetMqListener.cs b/Assets/Zion/Scripts/Sync1/NetMqListener.cs deleted file mode 100644 index c3ec6700..00000000 --- a/Assets/Zion/Scripts/Sync1/NetMqListener.cs +++ /dev/null @@ -1,144 +0,0 @@ -using NetMQ; -using NetMQ.Sockets; -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Threading; -using UnityEngine; - - -/// -/// 订阅模块 -/// -public class NetMqListener -{ - private string serverSubIP; - private string serverArea; - - private Thread _listenerWorker; - public bool _listenerCancelled; - /// - /// 自定义名称 - /// - public string typeName; - /// - /// 处理函数委托 - /// - /// - public delegate void ReceiceMessageInMono(st_Motions st); - public delegate void ReciveMessageInThread(st_Motions st); - /// - /// mono里处理消息 - /// - private readonly ReceiceMessageInMono _reciveMessageInMono; - /// - /// 线程里处理模型 - /// - private readonly ReciveMessageInThread _reciveMessageInThread; - - private readonly List _messageReciveStmotion = new List(); - - /// - /// 注册委托函数 - /// - public NetMqListener(string subIP,string area , ReciveMessageInThread _reciveInThread, ReceiceMessageInMono reciveInMono) - { - serverSubIP = subIP; - serverArea = area; - _reciveMessageInThread += _reciveInThread; - _reciveMessageInMono += reciveInMono; - StartListen(); - } - /// - /// 开始监听 - /// - public void StartListen() - { - _listenerCancelled = false; - _listenerWorker = new Thread(ByteListenerWork); - _listenerWorker.IsBackground = true; - _listenerWorker.Start(); - } - /// - /// 停止监听 - /// - public void StopListen() - { - _listenerCancelled = true; - //_listenerWorker.Join(); - } - - public SubscriberSocket subSocket; - /// - /// 接收线程 - /// - private void ByteListenerWork() - { - AsyncIO.ForceDotNet.Force(); - using (subSocket = new SubscriberSocket()) - { - subSocket.Options.ReceiveHighWatermark = 1000; - subSocket.Subscribe(serverArea); - subSocket.Connect(serverSubIP); - UnityEngine.Debug.Log("客户端开启成功" + _listenerCancelled); - - while (!_listenerCancelled) - { - //try - //{ - List frameByte = new List(); - if (!subSocket.TryReceiveMultipartBytes(ref frameByte)) continue; - //UnityEngine.Debug.Log("线程收到一条"); - st_Motions stS = new st_Motions(); - string tmp = Encoding.UTF8.GetString(frameByte[0]); - stS.m_iOperaType = BitConverter.ToInt32(frameByte[1], 0); - stS.m_sOperaData = new byte[frameByte[1].Length - 4]; - stS.area = tmp; - Array.Copy(frameByte[1], 4, stS.m_sOperaData, 0, frameByte[1].Length - 4); - - _reciveMessageInThread(stS); - //} - //catch (Exception e) - //{ - // UnityEngine.Debug.LogError(_listenerCancelled+"------------" + e.Message); - //} - } - subSocket.Close(); - } - NetMQConfig.Cleanup(); - UnityEngine.Debug.LogError("接收线程退出:"+typeName); - } - - public void AddToMono(st_Motions st) - { - _messageReciveStmotion.Add(st); - } - - /// - /// 处理一条byte[]消息 - /// - public void UpdateByte() - { - if (_messageReciveStmotion.Count > 0) - { - List tmps = _messageReciveStmotion.GetRange(0, _messageReciveStmotion.Count); - tmps.ForEach(data => - { - if (data.m_sOperaData != null) - { - _reciveMessageInMono(data); - UnityEngine.Debug.Log("处理:" + data.m_iOperaType + "st_motion" + "------" + data.m_sOperaData.Length); - } - else - { - UnityEngine.Debug.LogError(data.m_iOperaType + "st_motion结构错误"); - } - }); - _messageReciveStmotion.RemoveRange(0, tmps.Count); - } - } - -} - diff --git a/Assets/Zion/Scripts/Sync1/NetMqListener.cs.meta b/Assets/Zion/Scripts/Sync1/NetMqListener.cs.meta deleted file mode 100644 index b63672ab..00000000 --- a/Assets/Zion/Scripts/Sync1/NetMqListener.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1c56a871da744e04281c1949b604e3e0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/NetMqPublisher.cs b/Assets/Zion/Scripts/Sync1/NetMqPublisher.cs deleted file mode 100644 index 0fb33aaf..00000000 --- a/Assets/Zion/Scripts/Sync1/NetMqPublisher.cs +++ /dev/null @@ -1,108 +0,0 @@ -using NetMQ; -using NetMQ.Sockets; -using System; -using System.Collections; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading; -using UnityEngine; - -/// -/// 发布模块 -/// -public class NetMqPublisher -{ - private string serverPubIP; - - private Thread _listenerWorker; - public bool _listenerCancelled; - /// - /// 自定义名称 - /// - public string typeName; - public delegate void MessageDelegateByte(st_Motions st); - private readonly MessageDelegateByte _messageDelegateByte; - /// - /// 发送队列 - /// - private readonly ConcurrentQueue _messageQueueData = new ConcurrentQueue(); - - - public NetMqPublisher(string pubIP) - { - serverPubIP = pubIP; - StartListen(); - } - - /// - /// 开始监听 - /// - public void StartListen() - { - _listenerCancelled = false; - _listenerWorker = new Thread(ByteListenerWork); - _listenerWorker.IsBackground = true; - _listenerWorker.Start(); - } - /// - /// 停止监听 - /// - public void StopListen() - { - _listenerCancelled = true; - //_listenerWorker.Join(); - } - /// - /// 发送线程 - /// - private void ByteListenerWork() - { - AsyncIO.ForceDotNet.Force(); - using (var publishSocket = new PublisherSocket()) - { - publishSocket.Options.ReceiveHighWatermark = 1000; - publishSocket.Connect(serverPubIP); - UnityEngine.Debug.Log("客户端开启成功" + _listenerCancelled); - - while (!_listenerCancelled) - { - if (!_messageQueueData.IsEmpty) - { - st_Motions sendData = new st_Motions(); - if (_messageQueueData.TryDequeue(out sendData)) - { - if(_listenerCancelled) - { - UnityEngine.Debug.LogError("_listenerCancelled="+true); - } - byte[] tmpbytes = new byte[4 + sendData.m_sOperaData.Length]; - Array.Copy(BitConverter.GetBytes(sendData.m_iOperaType), 0, tmpbytes, 0, 4); - Array.Copy(sendData.m_sOperaData, 0, tmpbytes, 4, sendData.m_sOperaData.Length); - if (!_listenerCancelled && !publishSocket.SendMoreFrame(sendData.area).TrySendFrame(tmpbytes)) continue; - UnityEngine.Debug.Log("发送一个消息:" + sendData.area + "," + sendData.m_iOperaType); - } - } - } - publishSocket.Close(); - } - NetMQConfig.Cleanup(); - UnityEngine.Debug.LogError("发送线程退出:"+typeName); - } - - public void AddMessageToSendQue(string area, int type, byte[] data) - { - st_Motions sendData = new st_Motions { area = area, m_iOperaType = type, m_sOperaData = data }; - _messageQueueData.Enqueue(sendData); - } - public void AddMessageToSendQue(st_Motions st) - { - if (!string.IsNullOrEmpty(st.area)) - { - _messageQueueData.Enqueue(st); - } - else - { - UnityEngine.Debug.LogError("area空:type=" + st.m_iOperaType); - } - } -} diff --git a/Assets/Zion/Scripts/Sync1/NetMqPublisher.cs.meta b/Assets/Zion/Scripts/Sync1/NetMqPublisher.cs.meta deleted file mode 100644 index ddf6236e..00000000 --- a/Assets/Zion/Scripts/Sync1/NetMqPublisher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c85fca99ce47b964cb0439a78a984a09 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs b/Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs deleted file mode 100644 index 5d02b7f0..00000000 --- a/Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System; -using System.Text; - -/// -/// 单值同步 -/// -public class OneValueSyncObject : SyncBase -{ - public static Dictionary OneAxisSyncObjectList = new Dictionary(); - - [HideInInspector] - [SerializeField] - public ValueType valueType; - /// - /// 同步回调 - /// - [HideInInspector] - public Action callbackInmono; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public bool mybool; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public byte mybyte; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public short myshort; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public int myint; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public float myfloat; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public double mydouble; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public string mystring; - - [SerializeField] - [HideInInspector] - [DisplayOnly] - public Vector3 myvector3; - - public bool 自定义回调 = false; - - private st_Motions st_Motions = new st_Motions { m_iOperaType = 10006 }; - private int lastindex; - - /// - /// 打分回调 - /// - public Action action_apprisedetail; - private void OnDestroy() - { - if(OneAxisSyncObjectList.ContainsKey(Id)) - { - OneAxisSyncObjectList.Remove(Id); - } - } - public void InitDynamic(string id = "", Action callbackInMono = null, ValueType TmpvalueType = ValueType.Null) - { - if (GameManage.Instance.is单机模式) - { - return; - } - - if (hasInit) - { - Debug.Log("已经初始化,不能重复初始化"); - return; - } - - if (string.IsNullOrEmpty(id)) - { - if (string.IsNullOrEmpty(Id)) - { - Debug.LogError("Id为空"); - return; - } - } - else - { - Id = id; - } - - if(TmpvalueType!= ValueType.Null) - { - this.valueType = TmpvalueType; - } - else if(valueType== ValueType.Null) - { - Debug.LogError("类型为空:"+gameObject.name); - return; - } - - this.callbackInmono= callbackInMono; - st_Motions.area = LoadManage.Instance.currentRoomArea; - - List tmpbytes = new List(); - //syncId - tmpbytes.AddRange(BitConverter.GetBytes(LoadManage.Instance.SyncId)); - //id - byte[] data=Encoding.UTF8.GetBytes(Id); - tmpbytes.AddRange(BitConverter.GetBytes(data.Length)); - tmpbytes.AddRange(data); - //类型 - tmpbytes.Add((byte)valueType); - //回调 - tmpbytes.Add(callbackInmono == null?(byte)0:(byte)1); - switch (valueType) - { - case ValueType.Null: - Debug.LogError("类型不能为空"); - return; - case ValueType.Bool: - tmpbytes.Add(new byte()); - lastindex = tmpbytes.Count - 1; - break; - case ValueType.Byte: - tmpbytes.Add(new byte()); - lastindex = tmpbytes.Count - 1; - break; - case ValueType.Short: - tmpbytes.AddRange(new byte[2]); - lastindex = tmpbytes.Count - 2; - break; - case ValueType.Int: - tmpbytes.AddRange(new byte[4]); - lastindex = tmpbytes.Count - 4; - break; - case ValueType.Float: - tmpbytes.AddRange(new byte[4]); - lastindex = tmpbytes.Count - 4; - break; - case ValueType.Double: - tmpbytes.AddRange(new byte[8]); - lastindex = tmpbytes.Count - 8; - break; - case ValueType.String: - tmpbytes.AddRange(new byte[4]); - lastindex = tmpbytes.Count - 4; - break; - case ValueType.Vector3: - tmpbytes.AddRange(new byte[12]); - lastindex = tmpbytes.Count - 12; - break; - } - st_Motions.m_sOperaData = tmpbytes.ToArray(); - - OneAxisSyncObjectList.Add(Id, this); - hasInit = true; - } - - /// - /// 发送同步 - /// - public void SendSync() - { - if (!GameManage.Instance.is单机模式) - { - switch (valueType) - { - case ValueType.Null: - Debug.LogError("类型不能为空"); - return; - case ValueType.Bool: - st_Motions.m_sOperaData[lastindex] = mybool ? (byte)1 : (byte)0; - break; - case ValueType.Byte: - st_Motions.m_sOperaData[lastindex] = mybyte; - break; - case ValueType.Short: - Array.Copy(BitConverter.GetBytes(myshort), 0, st_Motions.m_sOperaData, lastindex, 2); - break; - case ValueType.Int: - Array.Copy(BitConverter.GetBytes(myint), 0, st_Motions.m_sOperaData, lastindex, 4); - break; - case ValueType.Float: - Array.Copy(BitConverter.GetBytes(myfloat), 0, st_Motions.m_sOperaData, lastindex, 4); - break; - case ValueType.Double: - Array.Copy(BitConverter.GetBytes(mydouble), 0, st_Motions.m_sOperaData, lastindex, 8); - break; - case ValueType.String: - byte[] tmpstring = Encoding.UTF8.GetBytes(mystring); - Array.Copy(BitConverter.GetBytes(tmpstring.Length), 0, st_Motions.m_sOperaData, lastindex, 4); - byte[] data = new byte[lastindex + 4 + tmpstring.Length]; - Array.Copy(st_Motions.m_sOperaData, 0, data, 0, lastindex + 4); - Array.Copy(tmpstring, 0, data, lastindex + 4, tmpstring.Length); - st_Motions.m_sOperaData = data; - break; - case ValueType.Vector3: - Array.Copy(BitConverter.GetBytes(myvector3.x), 0, st_Motions.m_sOperaData, lastindex, 4); - Array.Copy(BitConverter.GetBytes(myvector3.y), 0, st_Motions.m_sOperaData, lastindex + 4, 4); - Array.Copy(BitConverter.GetBytes(myvector3.z), 0, st_Motions.m_sOperaData, lastindex + 8, 4); - break; - } - LoadManage.Instance.RSclient.Send(st_Motions); - } - } - - /// - /// 设置值 - /// - public void SetValue(int start,byte[] data) - { - switch ((ValueType)(data[start])) - { - case ValueType.Null: - Debug.LogError("类型不能为空"); - return ; - case ValueType.Bool: - mybool = (data[start + 2] == 1 ? true : false); - break; - case ValueType.Byte: - mybyte = data[start+2]; - break; - case ValueType.Short: - myshort = BitConverter.ToInt16(data, start+2); - break; - case ValueType.Int: - myint = BitConverter.ToInt32(data, start + 2); - break; - case ValueType.Float: - myfloat = BitConverter.ToSingle(data, start + 2); - break; - case ValueType.Double: - mydouble = BitConverter.ToDouble(data, start + 2); - break; - case ValueType.String: - int length = BitConverter.ToInt32(data, start + 2); - mystring = Encoding.UTF8.GetString(data, start + 6, length); - break; - case ValueType.Vector3: - myvector3.x = BitConverter.ToSingle(data, start + 2); - myvector3.y= BitConverter.ToSingle(data, start + 6); - myvector3.z = BitConverter.ToSingle(data, start + 10); - break; - } - } -} -public enum ValueType -{ - Null, - Bool, - Byte, - Short, - Int, - Float, - Double, - String, - Vector3 -} diff --git a/Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs.meta b/Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs.meta deleted file mode 100644 index b7b2325d..00000000 --- a/Assets/Zion/Scripts/Sync1/OneValueSyncObject.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0ae554fc30ab6d042ae5837141efe935 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/PlayerMove.cs b/Assets/Zion/Scripts/Sync1/PlayerMove.cs deleted file mode 100644 index 663a12b5..00000000 --- a/Assets/Zion/Scripts/Sync1/PlayerMove.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System.Text; -using System; - -public class PlayerMove : MonoBehaviour -{ - public float speed = 3f; - Animator anim; - [HideInInspector] - public Vector3 move; - MyPlayer myPlayer; - - /// - /// 跟随模式 - /// - public bool FollowMode; - public bool Freeze; - void Start() - { - anim = GetComponent(); - // myPlayer = GameManage.Instance.me.GetComponent(); - if (!GameManage.Instance.is单机模式) - { - stdong.area = LoadManage.Instance.currentRoomArea; - stBudong.area = LoadManage.Instance.currentRoomArea; - byte[] idbyte = Encoding.UTF8.GetBytes(LoadManage.Instance.MyId); - //动 - byte[] data1 = new byte[4 + idbyte.Length + 1]; - Array.Copy(BitConverter.GetBytes(idbyte.Length), 0, data1, 0, 4); - Array.Copy(idbyte, 0, data1, 4, idbyte.Length); - data1[4 + idbyte.Length] = 1; - stdong.m_sOperaData = data1; - //停 - byte[] data2 = new byte[4 + idbyte.Length + 1]; - Array.Copy(BitConverter.GetBytes(idbyte.Length), 0, data2, 0, 4); - Array.Copy(idbyte, 0, data2, 4, idbyte.Length); - data2[4 + idbyte.Length] = 0; - stBudong.m_sOperaData = data2; - } - } - - - st_Motions stdong = new st_Motions { m_iOperaType = 8}; - st_Motions stBudong = new st_Motions { m_iOperaType = 8 }; - bool issend = false; - bool issendStop = false; - void Update() - { - if (!GameManage.Instance.is单机模式) - { - //if (Input.GetKeyDown(KeyCode.Y)) - //{ - // ChatPanel.instance.gameObject.SetActive(!ChatPanel.instance.gameObject.activeInHierarchy); - //} - - //if (ChatPanel.instance.gameObject.activeInHierarchy) - //{ - // return; - //} - } - - if (Freeze) return; - if (FollowMode) return; - - float x = Input.GetAxis("Horizontal"); - float z = Input.GetAxis("Vertical"); - move = new Vector3(x, 0, z); - - - move = new Vector3(x, 0,z); - - if (move != Vector3.zero) - { - issendStop = false; - //播放动画 - if (!issend) - { - if (LoadManage.Instance != null && LoadManage.Instance.RSclient != null) - LoadManage.Instance.RSclient.Send(stdong); - issend = true; - } - // 转向 - - move = Quaternion.Euler(0, Camera.main.transform.eulerAngles.y, 0) * move; - transform.position += move * speed* Time.deltaTime; - RotatePlayer(); - } - else - { - issend = false; - //停止动画 - if (!issendStop) - { - if (LoadManage.Instance!=null && LoadManage.Instance.RSclient != null) - LoadManage.Instance.RSclient.Send(stBudong); - issendStop = true; - } - } - UpdateAnim(); - } - void UpdateAnim() - { - anim.SetFloat("InputMagnitude", move.magnitude); - } - private void RotatePlayer() - { - //向量v围绕y轴旋转cameraAngle.y度 - Vector3 vec = Quaternion.Euler(0, 0, 0) * move; - Quaternion qua = Quaternion.LookRotation(vec); - transform.rotation = Quaternion.Lerp(transform.rotation, qua, Time.deltaTime * 100); - } -} - diff --git a/Assets/Zion/Scripts/Sync1/PlayerMove.cs.meta b/Assets/Zion/Scripts/Sync1/PlayerMove.cs.meta deleted file mode 100644 index 7abb991c..00000000 --- a/Assets/Zion/Scripts/Sync1/PlayerMove.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 33d3ab1f9bb81aa41929f206a3b702a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/SyncBase.cs b/Assets/Zion/Scripts/Sync1/SyncBase.cs deleted file mode 100644 index 56d826f3..00000000 --- a/Assets/Zion/Scripts/Sync1/SyncBase.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class SyncBase : MonoBehaviour -{ - [DisplayOnly] - public string Id = ""; - - public string 自定义; - /// - /// 是否已经初始化 - /// - [HideInInspector] - public bool hasInit; -} \ No newline at end of file diff --git a/Assets/Zion/Scripts/Sync1/SyncBase.cs.meta b/Assets/Zion/Scripts/Sync1/SyncBase.cs.meta deleted file mode 100644 index 061d8246..00000000 --- a/Assets/Zion/Scripts/Sync1/SyncBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 561fc113ec1f3b345b148960a6325261 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/Sync1/SyncTest.cs b/Assets/Zion/Scripts/Sync1/SyncTest.cs deleted file mode 100644 index 08305028..00000000 --- a/Assets/Zion/Scripts/Sync1/SyncTest.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class SyncTest:MonoBehaviour -{ - public bool isME; - public FunctionSync_Active active; - public FunctionSync_Animator animator; - public FunctionSync_Material material; - public FunctionSync_Scale scale; - public FunctionSync_PositionRoate PositionRoate; - public FunctionSync_Parent parent; - public FunctionSync_Parent transParent; - - int dir = 1; - private void Start() - { - //InitDynamic(gameObject.name, isME); - } - bool isred; - private void Update() - { - //if (isME) - //{ - // if (transform.position.y <= 3) - // { - // dir = 1; - // } - // else if (transform.position.y >= 30) - // { - // dir = -1; - // } - // transform.Translate(Vector3.up *3* dir * Time.deltaTime, Space.World); - // transform.Rotate(Vector3.up *3* Time.deltaTime); - //} - - if(Input.GetKeyDown( KeyCode.Z)) - { - //显隐 - if (!active.gameObject.activeInHierarchy) - { - active.ShowObject(); - } - else - { - active.DisShowObject(); - } - } - else if(Input.GetKeyDown(KeyCode.X)) - { - //材质 - if (isred) - { - isred = false; - material.SetMaterial("Material/green"); - } - else - { - isred = true; - material.SetMaterial("Material/red"); - } - } - else if (Input.GetKey(KeyCode.C)) - { - //缩放 - if(scale.transform.localScale.x>10) - { - dir = -1; - } - else if(scale.transform.localScale.x <0.3f) - { - dir = 1; - } - scale.transform.localScale += Vector3.one * dir * Time.deltaTime; - } - else if (Input.GetKeyDown(KeyCode.V)) - { - //动画 - animator.SetAnimatorState("SyncTest"); - } - else if(Input.GetKeyDown(KeyCode.B)) - { - //获取移动权限 - PositionRoate.GetControl(); - } - else if (Input.GetKeyDown(KeyCode.N)) - { - //释放移动权限 - PositionRoate.ReleaseControl(); - } - else if(Input.GetKeyDown(KeyCode.Space)) - { - //生成物体 - Vector3 pos = new Vector3(Random.Range(-50f, 50f), Random.Range(-50f, 50f), Random.Range(-50f, 50f)); - Vector3 roate= new Vector3(Random.Range(-50f, 50f), Random.Range(-50f, 50f), Random.Range(-50f, 50f)); - Vector3 scale= new Vector3(Random.Range(1f, 5f), Random.Range(1f, 5f), Random.Range(1f, 5f)); - FunctionSync_CreateObejct.Instance.CreateObejct("Prefabs/Test/Cube", pos, roate, scale); - } - else if(Input.GetKeyDown(KeyCode.P)) - { - transParent.SetParent(parent, new Vector3(10, 10, 10), new Vector3(30, 50, 90)); - } - } - - -} diff --git a/Assets/Zion/Scripts/Sync1/SyncTest.cs.meta b/Assets/Zion/Scripts/Sync1/SyncTest.cs.meta deleted file mode 100644 index 78e78ea5..00000000 --- a/Assets/Zion/Scripts/Sync1/SyncTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dcfbc35f49166e54ebb91f595e61f7e6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI.meta b/Assets/Zion/Scripts/UI.meta deleted file mode 100644 index 271abfaa..00000000 --- a/Assets/Zion/Scripts/UI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a805f9833a71ec142935604492207a0d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/CheckPanel.cs b/Assets/Zion/Scripts/UI/CheckPanel.cs deleted file mode 100644 index 7a21b323..00000000 --- a/Assets/Zion/Scripts/UI/CheckPanel.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using DataModel.Model; -using UnityEngine.UI; -using System.Linq; -using LitJson; -using TMPro; - -public class CheckPanel : MonoBehaviour -{ - practice practice1; - List practicesubjects; - - [HideInInspector] - public GameObject subejctItemPrefb; - [HideInInspector] - public GameObject seatItemPrefb; - - public VerticalLayoutGroup subjectGroup; - public VerticalLayoutGroup seatGroup; - public Button JoinBtn; - public Button CloseBtn; - public Text practiceNameText; - public Text subejctText; - public Text 训练方式Text; - public Text 操作流程Text; - - public Sprite 选中sprite; - public Sprite 未选中sprite; - - - public static CheckPanel instance; - public void Init(practice practice) - { - instance = this; - practice1 = practice; - practiceNameText.text = practice1.Name; - if (subejctItemPrefb == null) - { - subejctItemPrefb = Resources.Load("UI/Item/CheckPanelSubjectItem"); - } - - if (seatItemPrefb == null) - { - seatItemPrefb = Resources.Load("UI/Item/CheckPanelSeatItem"); - } - - JoinBtn.onClick.AddListener(Join); - CloseBtn.onClick.AddListener(() => - { - Destroy(gameObject,0.2f); - }); - - //获取所有practiceSubejct - StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.CallIP + "/Handler/Practice.ashx?action=querypracticesubject&PracticeId=" + practice1.Id, str => - { - var json = JsonMapper.ToObject>(str); - if (json.state) - { - //生成科目 - practicesubjects = json.data.OrderBy(a => a.OrderIndex).ToList(); - int index = 0; - foreach (var item in practicesubjects) - { - GameObject obj = Instantiate(subejctItemPrefb, subjectGroup.transform); - obj.GetComponent().Init(item, index); - index++; - } - - - Invoke("SetInteractable", 2); - } - else - { - Debug.LogError(json.message); - } - })); ; - } - - /// - /// 允许点击加入房间 - /// - public void SetInteractable() - { - JoinBtn.interactable = true; - } - private void Join() - { - //检查本人是否选择了岗位 - var list = subjectGroup.transform.GetComponentsInChildren(true).ToList().FindAll(a=>a.MyChose!=null); - if (list!=null && list.Count>0) - { - List bindDatas = new List(); - list.ForEach(b => - { - if (b.MyChose.userAccount.text == LoadManage.Instance.me.user.user_name) - { - bindDatas.Add(new BindData { practiceSeatId = b.MyChose.practiceseat1.Id, userAccount = b.MyChose.userAccount.text, userName = b.MyChose.userName.text }); - } - }); - - //更新选择的岗位 - StartCoroutine(MyNetMQClient.CallPost("http://" + MyNetMQClient.CallIP + "/Handler/PracticeSeat.ashx?action=UpdatePracticeSeatUser", new KeyValuePair[] { new KeyValuePair("BindData", JsonMapper.ToJson(bindDatas)) }, str => - { - var json = JsonMapper.ToObject(str); - if (json.state) - { - if ((int)json.data == 0) - { - //更新成功,加入房间 - LoadManage.Instance.currentPractice = practice1; - LoadManage.Instance.psubjects = practicesubjects; - Debug.Log("选择岗位成功"); - - //获取syncid - StartCoroutine(MyNetMQClient.CallGet("http://"+MyNetMQClient.CallIP+"/Handler/Practice.ashx?action=getAccountIndex&PracticeId="+practice1.Id+"&Account="+LoadManage.Instance.me.user.user_name,str2=> - { - var json2 = JsonMapper.ToObject(str2); - if (json2.state) - { - int syncid=(int)json2.data; - if(syncid==0) - { - Debug.LogError("未找到syncid"); - MessagePanel.ShowMessage("未找到syncid", RoomListPanel.instance.canvas.transform); - } - else - { - //创建mq连接 - Debug.Log("syncid为" + syncid); - try - { - LoadManage.Instance.CreateRoomServerClient(practice1.SubIP, practice1.PubIP, practice1.RoomArea, syncid); - } - catch (System.Exception e) - { - - GameObject.Find("Text (TMP)").GetComponent().text = e.Message; - } - - if (LoadManage.Instance.systemMode == SystemMode.PC) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("GameSencePC"); - } - else if(LoadManage.Instance.systemMode == SystemMode.MR) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("GameSenceMR"); - } - } - } - else - { - string msg = json2.message; - Debug.LogError(msg); - MessagePanel.ShowMessage(msg, RoomListPanel.instance.canvas.transform); - } - - })); - } - else - { - Debug.Log("有岗位未绑定成功,请重新选择"); - MessagePanel.ShowMessage("有岗位未绑定成功,请重新选择", RoomListPanel.instance.canvas.transform); - Destroy(gameObject); - } - } - else - { - string msg = json.message; - Debug.LogError(msg); - MessagePanel.ShowMessage(msg, RoomListPanel.instance.canvas.transform); - } - })); - } - else - { - Debug.Log("请选择岗位"); - MessagePanel.ShowMessage("请选择岗位", RoomListPanel.instance.canvas.transform); - } - } -} - -public struct BindData -{ - public string practiceSeatId; - public string userName; - public string userAccount; -} diff --git a/Assets/Zion/Scripts/UI/CheckPanel.cs.meta b/Assets/Zion/Scripts/UI/CheckPanel.cs.meta deleted file mode 100644 index d634d47f..00000000 --- a/Assets/Zion/Scripts/UI/CheckPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d8366a49a74a4984a8e5e7a327301e6d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/ChoseUserPanel.cs b/Assets/Zion/Scripts/UI/ChoseUserPanel.cs deleted file mode 100644 index 6f2e6aa2..00000000 --- a/Assets/Zion/Scripts/UI/ChoseUserPanel.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using System.Linq; - -public class ChoseUserPanel : MonoBehaviour -{ - SeatBindSubjectItem createRoomSubjectItem1; - CreateRoomSeatItem createRoomSeatItem1; - - public VerticalLayoutGroup group; - public Button tijiaoBtn; - public Button quxiaoBtn; - public Button CheckBtn; - public Button CloseBtn; - public InputField NameInput; - public InputField accountInput; - public ToggleGroup togglegroup; - - [HideInInspector] - public GameObject itemPrefb; - public void Init(SeatBindSubjectItem subjectItem, CreateRoomSeatItem createRoomSeatItem) - { - createRoomSubjectItem1 = subjectItem; - createRoomSeatItem1 = createRoomSeatItem; - if (itemPrefb==null) - { - itemPrefb = Resources.Load("UI/Item/ChoseUserItem"); - } - - quxiaoBtn.onClick.AddListener(() => - { - Destroy(gameObject); - }); - CloseBtn.onClick.AddListener(() => - { - Destroy(gameObject); - }); - - //生成item - //LoadManage.Instance.allUsers.ForEach(a => - //{ - // GameObject obj = Instantiate(itemPrefb, group.transform); - // if (subjectItem.seatItems.Any(b=>b.useraccount .text== a.login_name)) - // { - // obj.GetComponent().Init(a, false, createRoomSeatItem1, this) ; - // } - // else - // { - // obj.GetComponent().Init(a, true, createRoomSeatItem1,this); - // } - //}); - - //提交 - tijiaoBtn.onClick.AddListener(()=> - { - if(togglegroup.AnyTogglesOn()) - { - Toggle toggle=togglegroup.ActiveToggles().ToList().Find(a => a.isOn); - toggle.transform.GetComponentInParent().Chose(); - - - //销毁页面 - Destroy(gameObject); - } - }); - - //查询 - CheckBtn.onClick.AddListener(() => - { - if(NameInput.text=="" && accountInput.text=="") - { - //显示全部 - group.transform.GetComponentsInChildren(true).ToList().ForEach(a => - { - a.gameObject.SetActive(true); - }); - } - else - { - //筛选 - group.transform.GetComponentsInChildren(true).ToList().ForEach(a => - { - if(a.userName.text.Contains(NameInput.text) && a.userAccount.text.Contains(accountInput.text)) - { - a.gameObject.SetActive(true); - } - else - { - a.gameObject.SetActive(false); - } - }); - } - }); - } -} diff --git a/Assets/Zion/Scripts/UI/ChoseUserPanel.cs.meta b/Assets/Zion/Scripts/UI/ChoseUserPanel.cs.meta deleted file mode 100644 index 57ae4d65..00000000 --- a/Assets/Zion/Scripts/UI/ChoseUserPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1e5b7f8fbbf09184983a330f9cf2f89f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/CreateRoomPanel.cs b/Assets/Zion/Scripts/UI/CreateRoomPanel.cs deleted file mode 100644 index ea22f230..00000000 --- a/Assets/Zion/Scripts/UI/CreateRoomPanel.cs +++ /dev/null @@ -1,316 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; -using System.Linq; -using LitJson; -using System; - -public class CreateRoomPanel : MonoBehaviour -{ - /// - /// 创建名称界面 - /// - public Transform CreateNameP; - /// - /// 选择想定界面 - /// - public Transform ChoseThinkingP; - /// - /// 绑定岗位界面 - /// - public Transform BindSeatP; - - public InputField inputName; - public Toggle xunlianTog; - public Toggle kaoheTog; - public Button quxiaoBtn1; - public Button nextBtn1; - - public VerticalLayoutGroup group2; - public Button frontBtn2; - public Button nextBtn2; - - public Button frontBtn3; - public Button nextBtn3; - public VerticalLayoutGroup group3seat; - - public Text thinkingName; - public Text thinkingMode; - - public VerticalLayoutGroup group2_2; - - public Button closeBtn2; - public Button closeBtn3; - - /// - /// 房间名称 - /// - string PracticeName; - /// - /// 考核训练 - /// - string MissionModel; - /// - /// 选中的想定 - /// - [HideInInspector] - public thinkingfile choseThinkingfile; - /// - /// 岗位绑定的人员 - /// - List seatBindUser=new List(); - - [HideInInspector] - public GameObject 选择想定thinkingItemPrefb; - [HideInInspector] - public GameObject 选择想定subjectItemPrefb; - [HideInInspector] - public GameObject 席位分配subjectItemPrefb; - [HideInInspector] - public GameObject 席位分配seatItemPrefb; - [HideInInspector] - public GameObject 席位分配seat2Prefb; - [HideInInspector] - public GameObject choseUserPrefb; - - public static CreateRoomPanel instance; - - private void Awake() - { - instance = this; - if (选择想定thinkingItemPrefb==null) - { - 选择想定thinkingItemPrefb = Resources.Load("UI/Item/选择想定/CreateRoomThinkingItem"); - } - - if(选择想定subjectItemPrefb==null) - { - 选择想定subjectItemPrefb= Resources.Load("UI/Item/选择想定/CreateRoomSubjectItem"); - } - - if(席位分配subjectItemPrefb == null) - { - 席位分配subjectItemPrefb = Resources.Load("UI/Item/席位分配/subject"); - } - - if (席位分配seatItemPrefb == null) - { - 席位分配seatItemPrefb = Resources.Load("UI/Item/席位分配/seat"); - } - - if(席位分配seat2Prefb==null) - { - 席位分配seat2Prefb= Resources.Load("UI/Item/席位分配/seatitem"); - } - - if (choseUserPrefb==null) - { - choseUserPrefb = Resources.Load("UI/ChoseUserPanel"); - } - - quxiaoBtn1.onClick.AddListener(()=> - { - Destroy(gameObject); - }); - - closeBtn2.onClick.AddListener(() => - { - Destroy(gameObject); - }); - - closeBtn3.onClick.AddListener(() => - { - Destroy(gameObject); - }); - - //名字界面下一步按钮 - nextBtn1.onClick.AddListener(() => - { - if(!string.IsNullOrEmpty(inputName.text)) - { - PracticeName = inputName.text; - MissionModel = xunlianTog.isOn ? "训练" : "考核"; - CreateNameP.gameObject.SetActive(false); - ChoseThinkingP.gameObject.SetActive(true); - BindSeatP.gameObject.SetActive(false); - - UpdataThinking(); - } - }); - - //选择想定界面下一步按钮 - nextBtn2.onClick.AddListener(() => - { - if(choseThinkingfile!=null) - { - CreateNameP.gameObject.SetActive(false); - ChoseThinkingP.gameObject.SetActive(false); - BindSeatP.gameObject.SetActive(true); - //初始化席位分配界面 - InitSeatPanel(); - } - }); - - //选择想定界面上一步按钮 - frontBtn2.onClick.AddListener(() => - { - choseThinkingfile = null; - CreateNameP.gameObject.SetActive(true); - ChoseThinkingP.gameObject.SetActive(false); - BindSeatP.gameObject.SetActive(false); - }); - - //绑定人员界面确定按钮 - nextBtn3.onClick.AddListener(() => - { - List tmps = new List(); - group3seat.transform.GetComponentsInChildren(true).ToList().ForEach(a=> - { - if(a.useraccount.text!="999") - { - tmps.Add(new SeatBindUserData { seatId = a.seat1.seatId, subjectId = a.seat1.subjectId, username = a.username.text, useraccount = a.useraccount.text }); - } - }); - seatBindUser=tmps; - Create(); - }); - - //绑定人员界面上一步按钮 - frontBtn3.onClick.AddListener(() => - { - CreateNameP.gameObject.SetActive(false); - ChoseThinkingP.gameObject.SetActive(true); - BindSeatP.gameObject.SetActive(false); - group3seat.transform.GetComponentsInChildren().ToList().ForEach(a => - { - DestroyImmediate(a.gameObject); - }); - group3seat.transform.GetComponentsInChildren().ToList().ForEach(a => - { - DestroyImmediate(a.gameObject); - }); - }); - } - - /// - /// 更新想定文件 - /// - private void UpdataThinking() - { - group2.transform.GetComponentsInChildren(true).ToList().ForEach(a=> - { - DestroyImmediate(a.gameObject); - }); - - StartCoroutine(MyNetMQClient.CallGet("http://"+MyNetMQClient.CallIP+"/Handler/Thinkingfile.ashx?action=all", result => - { - var json = JsonMapper.ToObject>(result); - var jsondata = JsonMapper.ToObject(result)["data"]; - if (json.state) - { - jsondata.ValueAsArray().ToList().ForEach(a => - { - json.data.Find(b => b.Id == a["Id"].ToString()).CreateTime =DateTime.Parse(a["CreateTime"].ToString()); - }); - - var thinkingfiles = json.data.OrderByDescending(a=>a.CreateTime).ToList(); - int index = 0; - CreateRoomThinkingItem first=null; - thinkingfiles.ForEach(a => - { - GameObject obj = Instantiate(选择想定thinkingItemPrefb, group2.transform); - obj.GetComponent().Init(a); - if(index==0) - { - //第一个 - first = obj.GetComponent(); - } - index++; - }); - - if (first != null) - { - first.Chose(); - } - } - else - { - string msg = json.message; - Debug.LogError(msg); - } - })); - } - - - /// - /// 创建房间数据 - /// - public void Create() - { - if(choseThinkingfile!=null && !string.IsNullOrEmpty(MissionModel)) - { - KeyValuePair[] datas = new KeyValuePair[3]; - datas[0] = new KeyValuePair("thinkingfile_id",choseThinkingfile.Id); - datas[1] = new KeyValuePair("SeatBindUserData",JsonMapper.ToJson(seatBindUser)); - datas[2] = new KeyValuePair("data", JsonMapper.ToJson(new practice { Name= PracticeName, MissionModel= MissionModel })); - - StartCoroutine(MyNetMQClient.CallPost("http://"+MyNetMQClient.CallIP+"/Handler/Practice.ashx?action=add",datas, result => - { - var json = JsonMapper.ToObject(result); - if (json.state) - { - string str =json.data.ToString(); - //创建成功 - Debug.Log("创建房间成功:" + PracticeName); - MessagePanel.ShowMessage("创建房间成功", RoomListPanel.instance.canvas.transform); - - //房间列表刷新 - RoomListPanel.instance.Refresh(); - - Destroy(gameObject); - } - else - { - string msg = json.message; - Debug.LogError(msg); - MessagePanel.ShowMessage(msg, RoomListPanel.instance.canvas.transform); - } - })); - } - } - - /// - /// 初始化席位分配页面 - /// - private void InitSeatPanel() - { - ThinkingData data =JsonMapper.ToObject(choseThinkingfile.VirtualPath); - data.subjectsInfo.ForEach(a => - { - //创建科目 - GameObject obj = Instantiate(席位分配subjectItemPrefb, group3seat.transform); - SeatBindSubjectItem subjectScript = obj.GetComponent(); - subjectScript.Init(a); - //创建席位容器框 - GameObject obj2 = Instantiate(席位分配seatItemPrefb, group3seat.transform); - - a.seatInfos.ForEach(b => - { - //创建席位 - GameObject obj3 = Instantiate(席位分配seat2Prefb, obj2.transform); - CreateRoomSeatItem createRoomSeatItem = obj3.GetComponent(); - createRoomSeatItem.Init(b, subjectScript); - }); - }); - } -} - -public class SeatBindUserData -{ - public string subjectId; - public string seatId; - public string username; - public string useraccount; -} diff --git a/Assets/Zion/Scripts/UI/CreateRoomPanel.cs.meta b/Assets/Zion/Scripts/UI/CreateRoomPanel.cs.meta deleted file mode 100644 index 6d40694a..00000000 --- a/Assets/Zion/Scripts/UI/CreateRoomPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 924fefc00376dce4baadbfc4cf0238a2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/IPsettingPanel.cs b/Assets/Zion/Scripts/UI/IPsettingPanel.cs deleted file mode 100644 index 5372e547..00000000 --- a/Assets/Zion/Scripts/UI/IPsettingPanel.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using System.Net; - -public class IPsettingPanel : MonoBehaviour -{ - public static IPsettingPanel instance; - - public InputField syncidInput; - public InputField interfanceInput; - public Button quedingBtn; - public Button quxiaoBtn; - - private void Awake() - { - instance = this; - quedingBtn.onClick.AddListener(()=> - { - if (Check()) - { - PlayerPrefs.SetString("协同交互IP", syncidInput.text); - PlayerPrefs.SetString("接口服务IP", interfanceInput.text); - MyNetMQClient.CallIP = interfanceInput.text; - gameObject.SetActive(false); - } - else - { - Debug.Log("请检查IP格式"); - MessagePanel.ShowMessage("请检查IP格式", LoginPanel.instance.canvas.transform); - } - }); - - quxiaoBtn.onClick.AddListener(()=> - { - gameObject.SetActive(false); - }); - - gameObject.SetActive(false); - } - - public void Show() - { - syncidInput.text= PlayerPrefs.GetString("协同交互IP", ""); - interfanceInput.text= PlayerPrefs.GetString("接口服务IP", ""); - MyNetMQClient.CallIP = interfanceInput.text; - gameObject.SetActive(true); - } - - private bool Check() - { - if(string.IsNullOrEmpty(syncidInput.text) || string.IsNullOrEmpty(interfanceInput.text)) - { - return false; - } - - if(!syncidInput.text.Contains(":") || !interfanceInput.text.Contains(":")) - { - return false; - } - - string[] tmp1=syncidInput.text.Split(':'); - string[] tmp2 = interfanceInput.text.Split(':'); - - if(tmp1.Length!=2 || tmp2.Length!=2) - { - return false; - } - - IPAddress iPAddress1; - IPAddress iPAddress2; - if (!IPAddress.TryParse(tmp1[0], out iPAddress1) || !IPAddress.TryParse(tmp2[0], out iPAddress2)) - { - return false; - } - - int port1; - int port2; - if(!int.TryParse(tmp1[1],out port1)|| !int.TryParse(tmp2[1],out port2)) - { - return false; - } - - if(port2<=0 || port2<=0) - { - return false; - } - - //成功 - return true; - } - - -} diff --git a/Assets/Zion/Scripts/UI/IPsettingPanel.cs.meta b/Assets/Zion/Scripts/UI/IPsettingPanel.cs.meta deleted file mode 100644 index ad36b285..00000000 --- a/Assets/Zion/Scripts/UI/IPsettingPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 61549f3496950c44ca7ac9d695a7e7ce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item.meta b/Assets/Zion/Scripts/UI/Item.meta deleted file mode 100644 index 47234011..00000000 --- a/Assets/Zion/Scripts/UI/Item.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4272a394941acba4998e63fa7d934e69 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs b/Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs deleted file mode 100644 index 2ba5ffd1..00000000 --- a/Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; - -public class CheckPanelSeatItem : MonoBehaviour -{ - public practiceseat practiceseat1; - CheckPanelSubjectItem checkPanelSubjectItem; - - public Text SeatName,userName,userAccount; - public Toggle toggle; - public void Init(practiceseat practiceseat, CheckPanelSubjectItem subjectitem) - { - practiceseat1 = practiceseat; - checkPanelSubjectItem = subjectitem; - SeatName.text = practiceseat1.SeatName; - userName.text = practiceseat1.UserName; - userAccount.text = practiceseat1.UserAccount; - if (!string.IsNullOrEmpty(practiceseat1.UserAccount) && practiceseat1.UserAccount != "999") - { - //已被选择 - toggle.interactable = false; - toggle.isOn = true; - if(practiceseat1.UserAccount==LoadManage.Instance.me.user.user_name) - { - //是自己 - checkPanelSubjectItem.MyChose = this; - } - } - else - { - //未被选择 - toggle.interactable = true; - toggle.isOn = false; - - toggle.group = checkPanelSubjectItem.toggleGroup; - } - - toggle.onValueChanged.AddListener(a => - { - if(a) - { - //选中 - checkPanelSubjectItem.items.ForEach(b => - { - if (b.toggle.interactable) - { - b.userName.text = "虚兵"; - b.userAccount.text = "999"; - if (b != this) - { - b.toggle.isOn = false; - } - } - }); - userName.text = LoadManage.Instance.me.user.nickName; - userAccount.text = LoadManage.Instance.me.user.user_name; - checkPanelSubjectItem.MyChose = this; - } - else - { - if(checkPanelSubjectItem.MyChose==this) - { - checkPanelSubjectItem.MyChose = null; - userName.text = "虚兵"; - userAccount.text = "999"; - } - } - }); - } -} diff --git a/Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs.meta b/Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs.meta deleted file mode 100644 index b944f8ba..00000000 --- a/Assets/Zion/Scripts/UI/Item/CheckPanelSeatItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 05da0c26209fd8e4594bec16a6467e53 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs b/Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs deleted file mode 100644 index 7c87f5b9..00000000 --- a/Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; -using System.Linq; -using LitJson; - -public class CheckPanelSubjectItem : MonoBehaviour -{ - practicesubject practicesubject1; - List practiceseats1; - - /// - /// 科目管理的seatitem - /// - [HideInInspector] - public List items; - /// - /// 本人选择的岗位 - /// - [HideInInspector] - public CheckPanelSeatItem MyChose; - - public Button self; - public Text Name; - /// - /// 未启动 - /// - public Image state0; - /// - /// 进行中 - /// - public Image state1; - /// - /// 已结束 - /// - public Image state2; - - public ToggleGroup toggleGroup; - public void Init(practicesubject practicesubject,int index) - { - practicesubject1 = practicesubject; - - Name .text= practicesubject1.Name; - //if (practicesubject1.State==0) - //{ - // state0.gameObject.SetActive(true); - // state1.gameObject.SetActive(false); - // state2.gameObject.SetActive(false); - //} - //else if (practicesubject1.State == 1) - //{ - // state0.gameObject.SetActive(false); - // state1.gameObject.SetActive(true); - // state2.gameObject.SetActive(false); - //} - //else if (practicesubject1.State == 2) - //{ - // state0.gameObject.SetActive(false); - // state1.gameObject.SetActive(false); - // state2.gameObject.SetActive(true); - //} - - //获取所有practiceseat - StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.CallIP + "/Handler/Practice.ashx?action=querypracticeseat&PracticeSubjectId=" + practicesubject1.Id, str => - { - var json = JsonMapper.ToObject>(str); - if (json.state) - { - //生成岗位 - practiceseats1 = json.data.OrderBy(a=>a.SeatNo).ToList(); - items = new List(); - - foreach (var item in practiceseats1) - { - GameObject obj = Instantiate(CheckPanel.instance.seatItemPrefb, CheckPanel.instance.seatGroup.transform); - CheckPanelSeatItem script = obj.GetComponent(); - items.Add(script); - script.Init(item, this); - if (index == 0) - { - obj.SetActive(true); - } - else - { - obj.SetActive(false); - } - } - - //自己不能重复选择 - if (practiceseats1.Any(a => !string.IsNullOrEmpty(a.UserAccount) && a.UserAccount == LoadManage.Instance.me.user.user_name)) - { - items.ForEach(b => - { - b.toggle.interactable = false; - }); - } - - //点击科目按钮 - self.onClick.AddListener(() => - { - ShowSeat(); - ShowSuebjcet(); - ChangeButtonState(); - }); - - //默认显示第一个 - if(index==0) - { - ShowSuebjcet(); - transform.GetComponent().sprite = CheckPanel.instance.选中sprite; - } - else - { - transform.GetComponent().sprite = CheckPanel.instance.未选中sprite; - } - } - else - { - Debug.LogError(json.message); - } - })); - - } - - /// - /// 切换seat - /// - public void ShowSeat() - { - CheckPanel.instance.seatGroup.transform.GetComponentsInChildren(true).ToList().ForEach(a => - { - if(a.practiceseat1.Field_Char1== practicesubject1.Id) - { - a.gameObject.SetActive(true); - } - else - { - a.gameObject.SetActive(false); - } - }); - } - - /// - /// 切换subject - /// - public void ShowSuebjcet() - { - CheckPanel.instance.subejctText.text = practicesubject1.Name; - CheckPanel.instance.训练方式Text.text = practicesubject1.OperateModel; - CheckPanel.instance.操作流程Text.text = practicesubject1.OperateProcess; - } - - private void ChangeButtonState() - { - CheckPanel.instance.subjectGroup.transform.GetComponentsInChildren(true).ToList().ForEach(a => - { - if (a == this) - { - a.transform.GetComponent().sprite = CheckPanel.instance.选中sprite; - } - else - { - a.transform.GetComponent().sprite = CheckPanel.instance.未选中sprite; - } - }); - } -} diff --git a/Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs.meta b/Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs.meta deleted file mode 100644 index 46974ce4..00000000 --- a/Assets/Zion/Scripts/UI/Item/CheckPanelSubjectItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 930864f2f91d5874f95527641bc1ab00 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs b/Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs deleted file mode 100644 index af1c5299..00000000 --- a/Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; - -public class ChoseUserItem : MonoBehaviour -{ - admin_user user; - CreateRoomSeatItem createRoomSeatItem1; - ChoseUserPanel choseUserPanel1; - - public Text userName; - public Text userAccount; - public Toggle choseToggle; - public void Init(admin_user admin_User,bool isinterable, CreateRoomSeatItem createRoomSeatItem, ChoseUserPanel choseUserPanel) - { - user = admin_User; - createRoomSeatItem1 = createRoomSeatItem; - choseUserPanel1 = choseUserPanel; - userName.text = user.real_name; - userAccount.text = user.login_name; - choseToggle.group = choseUserPanel1.togglegroup; - choseToggle.interactable = isinterable; - } - - public void Chose() - { - //选择人员 - createRoomSeatItem1.username.text = user.real_name; - createRoomSeatItem1.useraccount.text = user.login_name; - } -} diff --git a/Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs.meta b/Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs.meta deleted file mode 100644 index abe96df3..00000000 --- a/Assets/Zion/Scripts/UI/Item/ChoseUserItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 95a999496042ec444b95af00b9213383 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs b/Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs deleted file mode 100644 index f2e125f4..00000000 --- a/Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; -using System.Linq; - -public class CreateRoomSubjectItem : MonoBehaviour -{ - SubejctsInfo subejctsInfo1; - - public List seatItems; - - public Text Name; - public Text subejctMode; - public Text seatinfo; - public Text stepinfo; - - public void Init(SubejctsInfo subejctsInfo,int index) - { - subejctsInfo1 = subejctsInfo; - - Name.text = subejctsInfo1.subjectName; - subejctMode.text = subejctsInfo1.mode; - seatinfo.text = subejctsInfo.seatInfo; - stepinfo.text = subejctsInfo1.stepInfo; - - //强制刷新 - - - ////获取所有seat - //StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.instance.CallIP + "/Handler/Subject.ashx?action=querysubjectseat&SubjectId="+ subjectId, result => - //{ - // var json = JObject.Parse(result); - // if (json["state"].ToObject()) - // { - // string str = json["data"].ToString(); - // var seats = JsonConvert.DeserializeObject>(str); - // seats.ForEach(a => - // { - // GameObject obj = Instantiate(CreateRoomPanel.instance.seatItemPrefb,CreateRoomPanel.instance.group3seat.transform); - // CreateRoomSeatItem script = obj.GetComponent(); - // seatItems.Add(script); - // script.Init(a,this); - // if (index == 0) - // { - // obj.gameObject.SetActive(true); - // } - // else - // { - // obj.gameObject.SetActive(false); - // } - // }); - - // self.onClick.AddListener(()=> { ShowSeats(); }); - // self.interactable = true; - // } - // else - // { - // string msg = json["message"].ToString(); - // Debug.LogError(msg); - // } - //})); - } - - private void ShowSeats() - { - CreateRoomPanel.instance.group3seat.transform.GetComponentsInChildren(true).ToList().ForEach(a=> - { - if(seatItems.Contains(a)) - { - a.gameObject.SetActive(true); - } - else - { - a.gameObject.SetActive(false); - } - }); - } -} diff --git a/Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs.meta b/Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs.meta deleted file mode 100644 index 91e9182a..00000000 --- a/Assets/Zion/Scripts/UI/Item/CreateRoomSubjectItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9c3db76530dc04244a0d5c1bf7d464b5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs b/Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs deleted file mode 100644 index 40208ca0..00000000 --- a/Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; -using System.Linq; -using LitJson; - -public class CreateRoomThinkingItem : MonoBehaviour -{ - thinkingfile thinkingfile1; - ThinkingData data; - List subjectitems1 = new List(); - - public Button self; - public Text Name; - public void Init(thinkingfile thinkingfile) - { - thinkingfile1 = thinkingfile; - Name.text = thinkingfile.Name; - - //创建科目item - CreateSubjectitem(); - - self.onClick.AddListener(()=> - { - Chose(); - }); - } - - /// - /// 创新建科目item - /// - private void CreateSubjectitem() - { - ThinkingData data =JsonMapper.ToObject(thinkingfile1.VirtualPath); - int index = 0; - data.subjectsInfo.ForEach(a => - { - GameObject obj = Instantiate(CreateRoomPanel.instance.选择想定subjectItemPrefb, CreateRoomPanel.instance.group2_2.transform); - CreateRoomSubjectItem script= obj.GetComponent(); - script.Init(a, index); - index++; - subjectitems1.Add(script); - }); - } - - /// - /// 选择 - /// - public void Chose() - { - //选中 - CreateRoomPanel.instance.choseThinkingfile = thinkingfile1; - - //显示想定信息 - CreateRoomPanel.instance.thinkingName.text = thinkingfile1.Name; - CreateRoomPanel.instance.thinkingMode.text = thinkingfile1.PracticeMode; - CreateRoomPanel.instance.group2_2.transform.GetComponentsInChildren(true).ToList().ForEach(a => - { - if (subjectitems1.Contains(a)) - { - a.gameObject.SetActive(true); - } - else - { - a.gameObject.SetActive(false); - } - }); - } -} diff --git a/Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs.meta b/Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs.meta deleted file mode 100644 index 05a14a58..00000000 --- a/Assets/Zion/Scripts/UI/Item/CreateRoomThinkingItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 237f2c66a911c5945bbe9b1fc549eef4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/RoomItem.cs b/Assets/Zion/Scripts/UI/Item/RoomItem.cs deleted file mode 100644 index 2fbfb23e..00000000 --- a/Assets/Zion/Scripts/UI/Item/RoomItem.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; -using System.Net.Sockets; -using System.Net; -using System; -using System.Text; - -public class RoomItem : MonoBehaviour -{ - public Text roomName; - public Button lookBtn; - public Button qidongBtn; - public Button closeBtn; - - practice practice1; - public void Init(practice practice) - { - practice1 = practice; - roomName.text = practice.Name; - - if(practice.State==0) - { - //未启动 - lookBtn.gameObject.SetActive(false); - //qidongBtn.gameObject.SetActive(true); - //closeBtn.gameObject.SetActive(false); - } - else if(practice.State==1) - { - //进行中 - lookBtn.gameObject.SetActive(true); - //qidongBtn.gameObject.SetActive(false); - //closeBtn.gameObject.SetActive(true); - } - - //不显示按钮 - qidongBtn.gameObject.SetActive(false); - closeBtn.gameObject.SetActive(false); - - - lookBtn.onClick.AddListener(()=> - { - //查看界面 - GameObject obj = Instantiate(RoomListPanel.instance.CheckPanelPrefb,RoomListPanel.instance.canvas.transform); - obj.GetComponent().Init(practice1); - }); - - qidongBtn.onClick.AddListener(() => - { - //启动 - qidongBtn.interactable = false; - Invoke("ReSetBtn", 3); - byte[] tmps = Encoding.UTF8.GetBytes(practice1.Id); - byte[] tmpbytes = new byte[8 + tmps.Length]; - Array.Copy(BitConverter.GetBytes(10), 0, tmpbytes, 0, 4); - Array.Copy(BitConverter.GetBytes(tmps.Length), 0, tmpbytes, 4, 4); - Array.Copy(tmps, 0, tmpbytes, 8, tmps.Length); - - LoadManage.Instance.UdpSend(tmpbytes, new IPEndPoint(IPAddress.Parse(MyNetMQClient.SyncServerIP.Split(':')[0]), int.Parse(MyNetMQClient.SyncServerIP.Split(':')[1]))); - }); - - closeBtn.onClick.AddListener(() => - { - //关闭 - closeBtn.interactable = false; - Invoke("ResetCloseBtn", 3); - - }); - } - - public void ReSetBtn() - { - if (qidongBtn != null) - { - qidongBtn.interactable = true; - } - } - - public void ResetCloseBtn() - { - if(closeBtn!=null) - { - closeBtn.interactable = true; - } - } -} diff --git a/Assets/Zion/Scripts/UI/Item/RoomItem.cs.meta b/Assets/Zion/Scripts/UI/Item/RoomItem.cs.meta deleted file mode 100644 index e4cb8a19..00000000 --- a/Assets/Zion/Scripts/UI/Item/RoomItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 653b3d77e9069ed469cf5b1d71f4aca5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/席位分配.meta b/Assets/Zion/Scripts/UI/Item/席位分配.meta deleted file mode 100644 index f5c1d394..00000000 --- a/Assets/Zion/Scripts/UI/Item/席位分配.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f5a906ddb68e90a4096e0d81522617dd -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs b/Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs deleted file mode 100644 index 8b9c7b28..00000000 --- a/Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; - -public class CreateRoomSeatItem : MonoBehaviour -{ - [HideInInspector] - public SeatInfo seat1; - SeatBindSubjectItem seatBindSubjectItem; - - public Text seatname,username,useraccount; - public Button chosebtn; - public Button resetbtn; - - public void Init(SeatInfo seat, SeatBindSubjectItem createRoomSubjectItem) - { - seat1 = seat; - seatBindSubjectItem = createRoomSubjectItem; - seatname.text = seat.seatName; - username.text = "虚兵"; - useraccount.text = "999"; - createRoomSubjectItem.seatItems.Add(this); - //重置 - resetbtn.onClick.AddListener(() => - { - username.text = "虚兵"; - useraccount.text = "999"; - }); - - chosebtn.onClick.AddListener(() => - { - //显示选择人员界面 - GameObject obj = Instantiate(CreateRoomPanel.instance.choseUserPrefb,CreateRoomPanel.instance.transform); - obj.GetComponent().Init(seatBindSubjectItem,this); - }); - } -} diff --git a/Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs.meta b/Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs.meta deleted file mode 100644 index 11fa663c..00000000 --- a/Assets/Zion/Scripts/UI/Item/席位分配/CreateRoomSeatItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 27f4a9e817b081a4985720d45bc6c44c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs b/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs deleted file mode 100644 index b55fa713..00000000 --- a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class SeatBindSeatItem : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs.meta b/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs.meta deleted file mode 100644 index a883a034..00000000 --- a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSeatItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 98883bdcc19c946449f1de26052ec066 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs b/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs deleted file mode 100644 index c2f6022f..00000000 --- a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class SeatBindSubjectItem : MonoBehaviour -{ - public Text NaemText; - - SubejctsInfo subejctsInfo; - - public List seatItems; - - public void Init(SubejctsInfo subejct) - { - subejctsInfo = subejct; - NaemText.text = subejctsInfo.subjectName; - } - - -} diff --git a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs.meta b/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs.meta deleted file mode 100644 index 640a24a2..00000000 --- a/Assets/Zion/Scripts/UI/Item/席位分配/SeatBindSubjectItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7406ee1da8abd364cbada6aeba3e37e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/LoginPanel.cs b/Assets/Zion/Scripts/UI/LoginPanel.cs deleted file mode 100644 index c22cff44..00000000 --- a/Assets/Zion/Scripts/UI/LoginPanel.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using UnityEngine.Networking; -using System; -using DataModel.Model; -using LitJson; - -public class LoginPanel : MonoBehaviour -{ - public InputField zhanghao; - public InputField mima; - public Button quedingbtn; - public Canvas canvas; - public Button settingBtn; - public Button clearBtn; - public Button exitBtn; - public Button anchorSettingBtn; - - public static LoginPanel instance; - - private void Awake() - { - instance = this; - string zh=PlayerPrefs.GetString("HJZhangHu", ""); - string password=PlayerPrefs.GetString("HJMiMa", ""); - zhanghao.text = zh; - mima.text = password; - clearBtn.onClick.AddListener(() => - { - zhanghao.text = ""; - mima.text = ""; - }); - - quedingbtn.onClick.AddListener(() => - { - if (!string.IsNullOrEmpty(zhanghao.text) || !string.IsNullOrEmpty(mima.text)) - { - Login(zhanghao.text, mima.text); - } - }); - - settingBtn.onClick.AddListener(()=> - { - IPsettingPanel.instance.Show(); - }); - - exitBtn.onClick.AddListener(()=> - { - Application.Quit(); - }); - - anchorSettingBtn.onClick.AddListener(() => - { - UnityEngine.SceneManagement.SceneManager.LoadScene("GetAnchor"); - }); - } - - private void Login(string account, string password) - { - AuthReq user = new AuthReq(); - - user.passWord = password; - user.sysId = "5"; - user.userCode = "001"; - user.userName = account; - - User tmpuser = new User(); - - //172.16.1.92:8089 - - StartCoroutine(MyNetMQClient.InvokeWebPostByUploadhandler("http://"+MyNetMQClient.userIP+":8089/api/auth", JsonMapper.ToJson(user), (ok,result) => - { - if (ok) - { - JsonData jd = JsonMapper.ToObject(result); - if (jd["success"].ValueAsBoolean()) - { - sys_user tmp = new sys_user(); - //在这里取数据 - tmp.user_name = jd["value"]["userInfo"]["userName"].ToString(); - if (jd["value"]["userInfo"]["userCode"] != null) - tmp.user_code = jd["value"]["userInfo"]["userCode"].ToString(); - tmp.user_id = int.Parse(jd["value"]["userInfo"]["userId"].ToString()); - if (jd["value"]["userInfo"]["deptId"] != null) - tmp.dept_id = int.Parse(jd["value"]["userInfo"]["deptId"].ToString()); - if (jd["value"]["userInfo"]["jobId"] != null) - tmp.job_id = int.Parse(jd["value"]["userInfo"]["jobId"].ToString()); - tmp.nickName = jd["value"]["userInfo"]["nickName"].ToString(); - if (jd["value"]["userInfo"]["avatar"] != null) - tmp.avatar = jd["value"]["userInfo"]["avatar"].ToString(); - if (jd["value"]["userInfo"]["certificateNumber"] != null) - tmp.introduce = jd["value"]["userInfo"]["certificateNumber"].ToString(); - - - tmpuser.user = tmp; - //获取角色 - StartCoroutine(MyNetMQClient.InvokeWebPostByUploadhandler("http://"+MyNetMQClient.userIP+":8087/role/queryRoleByUserId", JsonMapper.ToJson(new { userId = tmp.user_id.ToString() }), (ok2,result2) => - { - if (ok2) - { - JsonData jd2 = JsonMapper.ToObject(result2); - if (jd2["success"].ValueAsBoolean()) - { - foreach (JsonData item in jd2["value"]) - { - string tmpcode=item["roleCode"].ToString(); - - UserType ut; - if(Enum.TryParse(tmpcode, out ut)) - { - tmpuser.userType.Add(ut); - Debug.Log("角色:" + tmpcode); - } - else - { - Debug.LogError("未找到此角色:" + tmpcode); - } - - } - - //登录成功 - LoadManage.Instance.me = tmpuser; - PlayerPrefs.SetString("HJZhangHu", account); - PlayerPrefs.SetString("HJMiMa", password); - - if (LoadManage.Instance.systemMode == SystemMode.PC) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("MainSencePC"); - } - else if (LoadManage.Instance.systemMode == SystemMode.MR) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("MainSenceMR"); - } - } - else - { - MessagePanel.ShowMessage(jd2["msg"].ToString(), canvas.transform, null); - } - } - else - { - MessagePanel.ShowMessage(result2, canvas.transform, null); - } - })); - } - else - { - MessagePanel.ShowMessage(jd["msg"].ToString(), canvas.transform, null); - } - } - else - { - MessagePanel.ShowMessage(result, canvas.transform, null); - } - })); - } -} diff --git a/Assets/Zion/Scripts/UI/LoginPanel.cs.meta b/Assets/Zion/Scripts/UI/LoginPanel.cs.meta deleted file mode 100644 index bcd7b39d..00000000 --- a/Assets/Zion/Scripts/UI/LoginPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d2eae5c236c71bf4f9e4f121b184105b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/MessagePanel.cs b/Assets/Zion/Scripts/UI/MessagePanel.cs deleted file mode 100644 index b5eeb723..00000000 --- a/Assets/Zion/Scripts/UI/MessagePanel.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System; -using UnityEngine.UI; - -public class MessagePanel : MonoBehaviour -{ - Action callback; - public Text msgText; - public Button quedingBtn; - public Button quxiaoBtn; - - public static GameObject messageItem; - - public void Init(string msg, Action call) - { - msgText.text = msg; - callback = call; - if(call==null) - { - quedingBtn.gameObject.SetActive(false); - quxiaoBtn.gameObject.SetActive(false); - //无回调 - Invoke("delete", 5); - } - else - { - //有回调 - quedingBtn.onClick.AddListener(() => - { - callback(true); - Destroy(gameObject); - }); - - quxiaoBtn.onClick.AddListener(() => - { - callback(false); - Destroy(gameObject); - }); - } - } - - public void delete() - { - callback = null; - Destroy(gameObject); - } - - - public static void ShowMessage(string msg,Transform canvns,Action back=null) - { - if(messageItem==null) - { - messageItem = Resources.Load("UI/MessagePanel"); - } - GameObject obj = Instantiate(messageItem, canvns); - obj.GetComponent().Init(msg, back); - } - -} diff --git a/Assets/Zion/Scripts/UI/MessagePanel.cs.meta b/Assets/Zion/Scripts/UI/MessagePanel.cs.meta deleted file mode 100644 index d06afa76..00000000 --- a/Assets/Zion/Scripts/UI/MessagePanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 38dc4e14732fa4648a0bf9ce59068e1a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/RoomListPanel.cs b/Assets/Zion/Scripts/UI/RoomListPanel.cs deleted file mode 100644 index 26468bdb..00000000 --- a/Assets/Zion/Scripts/UI/RoomListPanel.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using System.Linq; -using DataModel.Model; -using System; -using LitJson; - -public class RoomListPanel : MonoBehaviour -{ - public GridLayoutGroup connect; - [HideInInspector] - public GameObject itemPrefb; - public Button refreshBtn; - public Button createBtn; - public Canvas canvas; - public Text DateTimeText; - public Button SettingBtn; - public Button QuitBtn; - public Text UserNameText; - public SystrmSettingPanel systrmSettingPanel; - - [HideInInspector] - public GameObject CreateRoomPrefb; - [HideInInspector] - public GameObject CheckPanelPrefb; - - public static RoomListPanel instance; - - private void Awake() - { - instance = this; - if (itemPrefb==null) - { - itemPrefb = Resources.Load("UI/Item/roomItem"); - } - - if(CheckPanelPrefb==null) - { - CheckPanelPrefb = Resources.Load("UI/CheckPanel"); - } - - - - refreshBtn.onClick.AddListener(() => - { - //刷新 - Refresh(); - }); - - createBtn.onClick.AddListener(() => - { - //创建 - if (CreateRoomPrefb == null) - { - CreateRoomPrefb = Resources.Load("UI/CreateRoomPanel"); - } - - GameObject obj = Instantiate(CreateRoomPrefb, canvas.transform); - }); - - QuitBtn.onClick.AddListener(() => - { - LoadManage.Instance.me = null; - if (LoadManage.Instance.systemMode == SystemMode.PC) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("LoginSencePC"); - } - else if(LoadManage.Instance.systemMode== SystemMode.MR) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("LoginSenceMR"); - } - }); - - SettingBtn.onClick.AddListener(() => - { - //显示配置界面 - systrmSettingPanel.gameObject.SetActive(true); - }); - - systrmSettingPanel.Init(); - } - - private void Start() - { - if (LoadManage.Instance != null) - { - UserNameText.text = LoadManage.Instance.me.user.nickName; - } - //刷新 - Refresh(); - } - - private void FixedUpdate() - { - //刷新按钮旋转 - if(refreshBtn.interactable==false) - { - refreshBtn.transform.Rotate(Vector3.forward, 5, Space.Self); - } - - DateTimeText.text = DateTime.Now.ToLongDateString()+" "+ DateTime.Now.ToLongTimeString(); - } - - /// - /// 刷新 - /// - public void Refresh() - { - refreshBtn.interactable = false; - Invoke("ResetBtn", 3); - connect.transform.GetComponentsInChildren(true).ToList().ForEach(a=> - { - DestroyImmediate(a.gameObject); - }); - - StartCoroutine(MyNetMQClient.CallGet("http://"+MyNetMQClient.CallIP+"/Handler/Practice.ashx?action=query&state=0,1", result=> - { - var json = JsonMapper.ToObject>(result); - var data=JsonMapper.ToObject(result)["data"]; - if(data!=null) - { - data.ValueAsArray().ToList().ForEach(a => - { - json.data.Find(b => b.Id == a["Id"].ToString()).CreateTime = DateTime.Parse(a["CreateTime"].ToString()); - }); - } - - if (json.state) - { - var list = json.data.OrderByDescending(a=>a.CreateTime).ToList(); - list.ToList().ForEach(a=> - { - //创建 - GameObject item = Instantiate(itemPrefb,connect.transform); - item.GetComponent().Init(a); - }); - } - else - { - string msg = json.message; - Debug.LogError(msg); - MessagePanel.ShowMessage(msg, canvas.transform); - } - })); - } - - public void ResetBtn() - { - if (refreshBtn != null) - { - refreshBtn.interactable = true; - } - } -} diff --git a/Assets/Zion/Scripts/UI/RoomListPanel.cs.meta b/Assets/Zion/Scripts/UI/RoomListPanel.cs.meta deleted file mode 100644 index ce22ac89..00000000 --- a/Assets/Zion/Scripts/UI/RoomListPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f9c96b37d963c1e47bc48452614c7b25 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/UI/SystrmSettingPanel.cs b/Assets/Zion/Scripts/UI/SystrmSettingPanel.cs deleted file mode 100644 index 31605556..00000000 --- a/Assets/Zion/Scripts/UI/SystrmSettingPanel.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class SystrmSettingPanel : MonoBehaviour -{ - public Dropdown ScreemMode; - public Slider 音量; - public Slider 音效; - public Button closeBtn; - - public void Init() - { - ScreemMode.value= PlayerPrefs.GetInt("屏幕模式", 0); - if(ScreemMode.value==0) - { - //全屏 - Screen.fullScreenMode = FullScreenMode.FullScreenWindow; - Screen.fullScreen = true; - } - else - { - //窗口化 - Screen.fullScreenMode = FullScreenMode.MaximizedWindow; - Screen.fullScreen = false; - } - - ScreemMode.onValueChanged.AddListener(index => - { - if(index==0) - { - //全屏模式 - } - else if(index==1) - { - //窗口模式 - } - - PlayerPrefs.SetInt("屏幕模式", index); - }); - - 音量.value = PlayerPrefs.GetFloat("音量", 1f); - 音效.value = PlayerPrefs.GetFloat("音效", 1f); - LoadManage.Instance.SourceLiangValue = 音量.value; - LoadManage.Instance.SourceXiaoValue = 音效.value; - - closeBtn.onClick.AddListener(() => - { - LoadManage.Instance.SourceLiangValue = 音量.value; - LoadManage.Instance.SourceXiaoValue = 音效.value; - gameObject.SetActive(false); - }); - } -} diff --git a/Assets/Zion/Scripts/UI/SystrmSettingPanel.cs.meta b/Assets/Zion/Scripts/UI/SystrmSettingPanel.cs.meta deleted file mode 100644 index 45b9d322..00000000 --- a/Assets/Zion/Scripts/UI/SystrmSettingPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a5fa4cfe95bdea54c8adc79dc1a53dbc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/manage/GameManage.cs b/Assets/Zion/Scripts/manage/GameManage.cs deleted file mode 100644 index 2b197077..00000000 --- a/Assets/Zion/Scripts/manage/GameManage.cs +++ /dev/null @@ -1,588 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; -using UnityEngine.UI; -using DataModel.Model; -using LitJson; - -public class GameManage : MonoBehaviour -{ - public static GameManage Instance; - - /// - /// 初始位置 - /// - public Transform initPos; - - public float OnceTime = 0.06f; - public int lerpTime = 2; - - public bool is单机模式; - - public Canvas canvas; - - - public ScoreManage scoreManage; - - - - #region 回调 - /// - /// 科目启停回调 - /// - [HideInInspector] - public Action action_subject; - /// - /// 步骤启停回调 - /// - [HideInInspector] - public Action action_step; - /// - /// 开始暂停回调 - /// - [HideInInspector] - public Action action_Pause; - /// - /// 关闭房间回调 - /// - [HideInInspector] - public Action action_close; - - #endregion - - private void Awake() - { - Instance = this; - //房间域 - LoadManage.programState = ProgramState.进行中; - - //初始化注册 - UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects().ToList().ForEach(a => - { - InitAllSyncInRoot(a.transform, false); - }); - - if (!is单机模式) - { - //获取步骤信息 - StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.CallIP + "/Handler/Practice.ashx?action=queryPracticesubjectStep&PracticeId=" + LoadManage.Instance.currentPractice.Id, str => - { - var json = JsonMapper.ToObject>(str); - if (json.state) - { - LoadManage.Instance.psteps = json.data; - //获取所有的practiceseat - StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.CallIP + "/Handler/Practice.ashx?action=querypracticeseat&PracticeId=" + LoadManage.Instance.currentPractice.Id, str2 => - { - var json2 = JsonMapper.ToObject>(str2); - if (json2.state) - { - - LoadManage.Instance.pseats = json2.data; - - LoadManage.Instance.myPracticeSeat = LoadManage.Instance.pseats.FindAll(a => a.UserAccount == LoadManage.Instance.me.user.user_name); - - //初始化打分系统 - scoreManage.Init(); - - //恢复当前训练信息 - var tmpps = LoadManage.Instance.psubjects.FindAll(a => a.State == 0); - if (tmpps != null && tmpps.Count > 0) - { - foreach (var item in tmpps) - { - practiceseat tmppseat = LoadManage.Instance.myPracticeSeat.Find(a => a.Field_Char1 == item.Id); - if (tmppseat != null) - { - //本人当前科目 - LoadManage.Instance.currentPracticeSubejct = item; - LoadManage.Instance.currentPracticeSeat = tmppseat; - //当前正在进行中步骤 - LoadManage.Instance.currentPracticeSubjectStep = LoadManage.Instance.psteps.Find(a => a.PracticeSubjectId == item.Id && a.SeatId == tmppseat.SeatId && a.StepState=="0"); - Debug.Log("当前科目:" + item.Name); - Debug.Log("当前岗位:" + tmppseat.SeatName); - if (LoadManage.Instance.currentPracticeSubjectStep != null) - { - Debug.Log("当前步骤正在进行中:" + LoadManage.Instance.currentPracticeSubjectStep.Name); - } - - - //激活当前步骤相应打分点(科目进行中且步骤未完成) - if (LoadManage.Instance.currentPractice.MissionModel == "考核") - { - //未完成的步骤 - var noOverSteps = LoadManage.Instance.psteps.FindAll(a => a.PracticeSubjectId == item.Id && a.SeatId == tmppseat.SeatId && a.StepState != "1"); - var allSB=scoreManage.transform.Find(item.Name).GetComponentsInChildren(true).ToList(); - if (noOverSteps!=null && noOverSteps.Count>0) - { - noOverSteps.ForEach(a => - { - allSB.FindAll(b => b.stepOrder == a.OrderIndex).ForEach(b => - { - b.SetActive(true); - }); - - }); - } - - } - - //开二维软件 - SoftManage.Instance.StartSoft(LoadManage.Instance.currentPractice.Id, LoadManage.Instance.currentPracticeSubejct.Name, LoadManage.Instance.currentPracticeSeat.SeatName, LoadManage.Instance.currentPracticeSeat.UserAccount, 0); - break; - } - } - } - - - - - //当前切换当前科目 - GetMaoDian(); - } - else - { - string msg = json2.message; - Debug.LogError(msg); - - } - })); - ; - } - else - { - string msg = json.message; - Debug.LogError(msg); - - } - })); - } - } - - /// - /// 获取锚点 - /// - private void GetMaoDian() - { - - //获取房间数据 - UpLoadMe(); - } - - private void OnDestroy() - { - action_subject = null; - action_step = null; - } - /// - /// 注册科目启停回调 - /// - /// practiceid,praticeSubjectId,科目名,是否开启 - public void SetSubjectAction(Action action_subject) - { - this.action_subject += action_subject; - } - /// - /// 注册步骤启停回调 - /// - /// practiceid,praticeSubjectId,科目名,pratciesubjectstepId,是否开启 - public void SetStepAction(Action action_step) - { - this.action_step += action_step; - } - /// - /// 注册开始暂停回调 (true:开始 ,false:暂停) - /// - /// - public void SetPauseAction(Action action_pause) - { - this.action_Pause = action_pause; - } - /// - /// 注册关闭回调 - /// - /// - public void SetCloseAction(Action action_close) - { - this.action_close = action_close; - } - - /// - /// 切换科目状态 - /// - /// - public void SubjectChange(string msg) - { - // practiceId + "," + praticeSubjectId + "," + subjectName + "," + (OpenOrClose ? "开" : "关") - string[] tmps = msg.Split(','); - string practiceId = tmps[0]; - string praticeSubjectId = tmps[1]; - string subjectName = tmps[2]; - string OpenOrClose = tmps[3]; - bool oc = true; - if (OpenOrClose == "开") - { - oc = true; - } - else if (OpenOrClose == "关") - { - oc = false; - } - else - { - Debug.LogError("错误:" + OpenOrClose); - return; - } - - if (practiceId == LoadManage.Instance.currentPractice.Id) - { - practicesubject ps = LoadManage.Instance.psubjects.Find(a => a.Id == praticeSubjectId); - if (ps != null) - { - if (oc) - { - //开 - if (LoadManage.Instance.currentPracticeSubejct != null && LoadManage.Instance.currentPracticeSubejct.OrderIndex != ps.OrderIndex) - { - Debug.LogError("此科目不能并行"); - return; - } - ps.State = 0; - LoadManage.Instance.currentPracticeSubejct = ps; - - practiceseat pseat = LoadManage.Instance.myPracticeSeat.Find(a => a.Field_Char1 == praticeSubjectId); - if (pseat != null) - { - //自己参与当前科目 - LoadManage.Instance.currentPracticeSeat = pseat; - Debug.Log("科目开启成功:" + ps.Name); - if (action_subject != null) - { - action_subject.Invoke(practiceId, praticeSubjectId, subjectName, oc); - } - - //开二维软件 - SoftManage.Instance.StartSoft(LoadManage.Instance.currentPractice.Id, LoadManage.Instance.currentPracticeSubejct.Name, LoadManage.Instance.currentPracticeSeat.SeatName, LoadManage.Instance.currentPracticeSeat.UserAccount, 0); - - - //激活自己相应打分 - if(LoadManage.Instance.currentPractice.MissionModel=="考核") - { - scoreManage.transform.Find(ps.Name).GetComponentsInChildren(true).ToList().ForEach(c => - { - if (c.seatName == pseat.SeatName) - { - c.SetActive(true); - } - }); - } - } - else - { - Debug.Log("未参与此科目:" + ps.Name); - } - - } - else - { - //关 - if (LoadManage.Instance.currentPracticeSubejct != null && LoadManage.Instance.currentPracticeSubejct.Id == ps.Id) - { - //自己参与当前科目 - ps.State = 1; - LoadManage.Instance.currentPracticeSubejct = null; - practiceseat pseat = LoadManage.Instance.myPracticeSeat.Find(a => a.Field_Char1 == praticeSubjectId); - if (pseat != null) - { - LoadManage.Instance.currentPracticeSeat = null; - Debug.Log("科目关闭成功:" + ps.Name); - if (action_subject != null) - { - action_subject.Invoke(practiceId, praticeSubjectId, subjectName, oc); - } - - //关闭所有相应打分 - if (LoadManage.Instance.currentPractice.MissionModel == "考核") - { - scoreManage.transform.Find(ps.Name).GetComponentsInChildren(true).ToList().ForEach(c => - { - c.SetActive(false); - }); - - //指挥提交总表 - if (pseat.SeatNo == "0") - { - scoreManage.SubmitApprise(subjectName); - } - } - } - else - { - Debug.Log("未参与此科目:" + ps.Name); - } - } - } - } - else - { - Debug.LogError("错误:未找到科目"); - } - } - } - - /// - /// 切换步骤状态 - /// - /// - public void StepChange(string msg) - { - // practiceId + "," + praticeSubjectId + "," + subjectName + "," + pratciesubjectstepId + "," + (OpenOrClose ? "开" : "关") - string[] tmps = msg.Split(','); - string practiceId = tmps[0]; - string praticeSubjectId = tmps[1]; - string subjectName = tmps[2]; - string pratciesubjectstepId = tmps[3]; - string OpenOrClose = tmps[4]; - bool oc = true; - if (OpenOrClose == "开") - { - oc = true; - } - else if (OpenOrClose == "关") - { - oc = false; - } - else - { - Debug.LogError("错误:" + OpenOrClose); - return; - } - - if (practiceId == LoadManage.Instance.currentPractice.Id) - { - practicesubjectstep step = LoadManage.Instance.psteps.Find(a => a.ID == pratciesubjectstepId); - if (step != null) - { - step.StepState = (oc ? 0 : 1).ToString(); - - if (action_step != null) - { - action_step.Invoke(practiceId, praticeSubjectId, subjectName, pratciesubjectstepId, oc); - } - - if (oc) - { - //开启步骤 - LoadManage.Instance.currentPracticeSubjectStep = step; - } - else - { - //结束步骤 - - LoadManage.Instance.currentPracticeSubjectStep = null; - - //提交此步骤子表分数 - scoreManage.transform.Find(subjectName).GetComponentsInChildren(true).ToList().ForEach(c => - { - if (c.stepOrder == step.OrderIndex) - { - c.Submit(); - } - }); - } - } - else - { - Debug.LogError("错误:未找到步骤"); - } - } - } - - /// - /// 注册一个根物体下所有同步组件 - /// - /// - public void InitAllSyncInRoot(Transform a, bool isPlayer, string id = "") - { - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (isPlayer) - { - b.gameObject.name = id + b.gameObject.name; - } - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (isPlayer) - { - b.gameObject.name = id + b.gameObject.name; - } - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (isPlayer) - { - b.gameObject.name = id + b.gameObject.name; - } - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (isPlayer) - { - b.gameObject.name = id + b.gameObject.name; - } - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (isPlayer) - { - b.gameObject.name = id + b.gameObject.name; - } - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (isPlayer) - { - b.gameObject.name = id + b.gameObject.name; - } - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (b.isAutoInit) - { - b.Init(); - } - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - b.Init(); - }); - a.GetComponentsInChildren(true).ToList().ForEach(b => - { - if (!b.自定义回调) - { - b.InitDynamic("sync_" + b.name, null, b.valueType); - } - - }); - - - } - /// - /// 初始化科目 - /// - public void InitSubject() - { - //初始化科目数据 - //设备位置状态 - //初始化评估 - - } - - - [HideInInspector] - public float checkTime = 6; - private void Update() - { -#if !UNITY_EDITOR - - // //检查是否去服务器连接 - // checkTime -= Time.deltaTime; - // if (checkTime < 0) - // { - // Debug.Log("时间超过6秒"); - // Quit(); - // } -#endif - } - - /// - /// 上传自己的信息(加入房间,并获取房间信息) - /// - public void UpLoadMe() - { - if (!is单机模式) - { - LoadManage.Instance.RSclient.Send(LoadManage.Instance.currentRoomArea,32,new byte[1]); - Debug.Log("发送加入房间"); - } - - //关闭界面 - } - - /// - /// 退出房间 - /// - public void Quit() - { - Debug.Log("退出房间"); - //初始化 - LoadManage.programState = ProgramState.结束; - OneValueSyncObject.OneAxisSyncObjectList.Clear(); - FunctionSync_PositionRoate.positionRoateSyncObejctList.Clear(); - FunctionSync_Video.dicVideo.Clear(); - FunctionSync_Media.functionSync_MediaDic.Clear(); - FunctionSync_CreateObejct.createDic.Clear(); - - FunctionSync_CreateObejct.Instance = null; - - action_subject = null; - action_step = null; - - //发送退出房间指令 - if (!is单机模式 && LoadManage.Instance.me != null) - { - //byte[] bytes = Encoding.UTF8.GetBytes(LoadManage.Instance.MyId); - //byte[] names = Encoding.UTF8.GetBytes(LoadManage.Instance.MyName); - //byte[] tmps = new byte[8 + bytes.Length+ names.Length]; - //Array.Copy(BitConverter.GetBytes(bytes.Length), 0, tmps, 0, 4); - ////id - //Array.Copy(bytes, 0, tmps, 4, bytes.Length); - ////name - //Array.Copy(BitConverter.GetBytes(names.Length), 0, tmps, 4 + bytes.Length, 4); - //Array.Copy(names, 0, tmps, 8 + bytes.Length, names.Length); - //LoadManage.Instance.RSclient.Send(LoadManage.Instance.currentRoomArea, 10, tmps); - //Debug.Log("发送退出房间"); - } - //初始化LoadManage脚本 - LoadManage.Instance.currentRoomArea = ""; - //LoadManage.Instance.MyId = ""; - LoadManage.Instance.SyncId = 0; - checkTime = 10; - - //断开通信 - LoadManage.Instance.RemoveRoomServerClient(); - if (LoadManage.Instance.systemMode == SystemMode.PC) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("MainSencePC"); - } - else if (LoadManage.Instance.systemMode == SystemMode.MR) - { - UnityEngine.SceneManagement.SceneManager.LoadScene("MainSenceMR"); - } - } - - - -} \ No newline at end of file diff --git a/Assets/Zion/Scripts/manage/GameManage.cs.meta b/Assets/Zion/Scripts/manage/GameManage.cs.meta deleted file mode 100644 index 8c4c8205..00000000 --- a/Assets/Zion/Scripts/manage/GameManage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b4ef00557079cb54fb84de19b7380906 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 600 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/manage/LoadManage.cs b/Assets/Zion/Scripts/manage/LoadManage.cs deleted file mode 100644 index 16b39f99..00000000 --- a/Assets/Zion/Scripts/manage/LoadManage.cs +++ /dev/null @@ -1,793 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using UnityEngine; -using UnityEngine.SceneManagement; -using System.Linq; -using System.Collections; -using DataModel.Model; -using System.Net.Sockets; -using System.Threading; -using System.Net; -using LitJson; -using TMPro; -using System.IO; - -public class LoadManage : MonoBehaviour -{ - public static LoadManage Instance; - - - /// - /// 系统模式 - /// - public SystemMode systemMode; - - /// - /// 本人账户信息 - /// - [HideInInspector] - public User me; - /// - /// 当前训练 (进房间前赋值) - /// - [HideInInspector] - public practice currentPractice = null; - /// - /// 当前科目 - /// - [HideInInspector] - public practicesubject currentPracticeSubejct = null; - /// - /// 当前岗位 - /// - [HideInInspector] - public practiceseat currentPracticeSeat = null; - /// - /// 当前步骤 - /// - [HideInInspector] - public practicesubjectstep currentPracticeSubjectStep = null; - /// - /// 本人在训练中所有岗位信息 - /// - [HideInInspector] - public List myPracticeSeat = new List(); - - /// - /// 训练科目 (进房间前赋值) - /// - [HideInInspector] - public List psubjects; - /// - /// 训练步骤 - /// - [HideInInspector] - public List psteps; - /// - /// 训练岗位 - /// - [HideInInspector] - public List pseats; - - /// - /// 音量大小 - /// - [DisplayOnly] - public float SourceLiangValue; - /// - /// 音效大小 - /// - [DisplayOnly] - public float SourceXiaoValue; - - [HideInInspector] - public string MyId; - - - - - /// - /// 房间域 "1room" - /// - [DisplayOnly] - public string currentRoomArea; - /// - /// 同步Id - /// - [DisplayOnly] - public int SyncId; - /// - /// 训练状态 - /// - public static ProgramState programState = ProgramState.结束; - /// - /// 是否暂停 - /// - public static bool isPause; - - /// - /// 与RoomServer通信 - /// - [DisplayOnly] - public MyNetMQClient RSclient; - - #region UDP - [HideInInspector] - public UdpClient udpClient; - bool udpRun; - int refreshTime = 0; - #endregion - - - /// - /// 人员 - /// - public static List persons = new List(); - - private void Awake() - { - Instance = this; - DontDestroyOnLoad(gameObject); - //启动(测试用) - udpClient = new UdpClient(8889); - - udpRun = true; - Thread thread = new Thread(UdpRecive); - thread.IsBackground = true; - thread.Start(); -#if UNITY_EDITOR - UnityEngine.Debug.unityLogger.logEnabled = true; -#else - UnityEngine.Debug.unityLogger.logEnabled = false; -#endif - } - void Start() - { - //设置不休眠 - Screen.sleepTimeout = SleepTimeout.NeverSleep; - List tmps = File.ReadAllLines(Application.streamingAssetsPath + "/MainSetting.txt").ToList(); - int porta, portb, portc; - IPAddress ipd; - tmps.ForEach(a => - { - string[] data = a.Split('='); - if (a.Split('=')[0] == "协同交互服务UDP") - { - IPAddress.Parse(data[1].Split(':')[0]); - if (int.TryParse(data[1].Split(':')[1], out portb)) - { - //MyNetMQClient.SyncServerIP = data[1]; - MyNetMQClient.SyncServerIP = "192.168.0.103"; - - } - else - { - Debug.LogError("协同交互服务UDP配置错误"); - } - } - }); - GetAllUser(); - } - - private void Update() - { - if (refreshTime > 0) - { - //刷新房间列表 - if (RoomListPanel.instance != null && UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.Contains("MainSence")) - { - RoomListPanel.instance.Refresh(); - refreshTime = 0; - } - } - } - - private void UdpRecive() - { - while (udpRun) - { - try - { - IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Any, 0); - byte[] data = udpClient.Receive(ref iPEndPoint); - int type = BitConverter.ToInt32(data, 0); - if (type == 13) - { - if (LoadManage.programState == ProgramState.结束) - { - //开启房间成功 - UnityEngine.Debug.Log("开启房间成功"); - string practiceid = Encoding.UTF8.GetString(data, 4, data.Length - 4); - refreshTime++; - } - } - else if (type == 26) - { - if (LoadManage.programState == ProgramState.进行中) - { - //开启二维软件失败 - int length = BitConverter.ToInt32(data, 4); - string arg = Encoding.UTF8.GetString(data, 8, length); - string[] tmps = arg.Split(':'); - SoftManage.Instance.ChangeSoftSubject(tmps[0], tmps[1], SoftManage.Instance.softName, tmps[2], tmps[3]); - } - } - } - catch - { - - } - } - } - /// - /// 发送udp消息 - /// - /// - /// - public void UdpSend(byte[] data, IPEndPoint endPoint) - { - udpClient.Send(data, data.Length, endPoint); - } - - /// - /// 获取所有本系统人员数据,导调角色,操作手 - /// - private void GetAllUser() - { - //使用真实接口 - - //172.16.1.92:8087 - - //获取士兵 - StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.userIP + ":8087/role?roleName=士兵", result1 => - { - JsonData jd = JsonMapper.ToObject(result1); - if (jd["success"].ValueAsBoolean()) - { - - List tmp = new List(); - foreach (JsonData item in jd["value"]) - { - tmp.Add(int.Parse(item["roleId"].ToString())); - } - if (tmp.Count > 0) - { - string tmpjsonvalue = JsonMapper.ToJson(tmp); - //获取所有士兵user - StartCoroutine(MyNetMQClient.InvokeWebPostByUploadhandler("http://" + MyNetMQClient.userIP + ":8087/user/queryAllUsers", JsonMapper.ToJson(new { limit = 1000, roleDtoList = tmpjsonvalue }), (ok, result2) => - { - if (ok) - { - JsonData jd2 = JsonMapper.ToObject(result2); - if (jd2["success"].ValueAsBoolean()) - { - foreach (JsonData item in jd2["value"]["results"]) - { - sys_user tmpUser = new sys_user(); - //在这里取数据 - tmpUser.user_name = item["userName"].ToString(); - if (item["userCode"] != null) - tmpUser.user_code = item["userCode"].ToString(); - tmpUser.user_id = int.Parse(item["userId"].ToString()); - if (item["deptId"] != null) - tmpUser.dept_id = int.Parse(item["deptId"].ToString()); - if (item["jobId"] != null) - tmpUser.job_id = int.Parse(item["jobId"].ToString()); - if (item["nickName"] != null) - tmpUser.nickName = item["nickName"].ToString(); - if (item["avatar"] != null) - tmpUser.avatar = item["avatar"].ToString(); - if (item["certificateNumber"] != null) - tmpUser.introduce = item["certificateNumber"].ToString(); - persons.Add(tmpUser); - } - - - //获取所有指挥员 - StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.userIP + ":8087/role?roleName=指挥员", result3 => - { - JsonData jd3 = JsonMapper.ToObject(result3); - if (jd3["success"].ValueAsBoolean()) - { - List tmp2 = new List(); - foreach (JsonData item in jd3["value"]) - { - tmp2.Add(int.Parse(item["roleId"].ToString())); - } - if (tmp2.Count > 0) - { - string tmpjsonvalue2 = JsonMapper.ToJson(tmp2); - //获取所有指挥员user - StartCoroutine(MyNetMQClient.InvokeWebPostByUploadhandler("http://" + MyNetMQClient.userIP + ":8087/user/queryAllUsers", JsonMapper.ToJson(new { limit = 1000, roleDtoList = tmpjsonvalue2 }), (ok2, result4) => - { - if (ok2) - { - JsonData jd4 = JsonMapper.ToObject(result4); - if (jd4["success"].ValueAsBoolean()) - { - foreach (JsonData item in jd4["value"]["results"]) - { - sys_user tmpUser = new sys_user(); - //在这里取数据 - tmpUser.user_name = item["userName"].ToString(); - if (item["userCode"] != null) - tmpUser.user_code = item["userCode"].ToString(); - tmpUser.user_id = int.Parse(item["userId"].ToString()); - if (item["deptId"] != null) - tmpUser.dept_id = int.Parse(item["deptId"].ToString()); - if (item["jobId"] != null) - tmpUser.job_id = int.Parse(item["jobId"].ToString()); - if (item["nickName"] != null) - tmpUser.nickName = item["nickName"].ToString(); - persons.Add(tmpUser); - } - - Debug.Log("获取人员完成"); - - //获取考核配置 - StartCoroutine(MyNetMQClient.CallGet("http://" + MyNetMQClient.CallIP + "/3DConfig/考核动作标题配置.xml", back => - { - ScoreManage.SetXml(back); - Debug.Log("考核配置获取完成"); - //跳转 - if (systemMode == SystemMode.PC) - { - SceneManager.LoadScene("LoginSencePC"); - } - else if (systemMode == SystemMode.MR) - { - SceneManager.LoadScene("LoginSenceMR"); - } - })); - } - else - { - string msg = jd4["msg"].ToJson(); - MessagePanel.ShowMessage(msg, GameObject.Find("Canvas").transform, null); - } - } - else - { - MessagePanel.ShowMessage(result4, GameObject.Find("Canvas").transform, null); - } - })); - } - } - else - { - string msg = jd3["msg"].ToJson(); - MessagePanel.ShowMessage(msg, GameObject.Find("Canvas").transform, null); - } - })); - - } - else - { - string msg = jd2["msg"].ToJson(); - MessagePanel.ShowMessage(msg, GameObject.Find("Canvas").transform, null); - } - } - else - { - MessagePanel.ShowMessage(result2, GameObject.Find("Canvas").transform, null); - } - })); - } - } - else - { - string msg = jd["msg"].ToJson(); - MessagePanel.ShowMessage(msg, GameObject.Find("Canvas").transform, null); - } - })); - } - - - /// - /// 创建与roomServer通信的客户端 - /// - public void CreateRoomServerClient(string roomServerSubIP, string roomServerPubIP, string roomArea, int syncId) - { - if (RSclient == null) - { - //测试 - //roomServerPubIP = "tcp://192.168.1.125:56987"; - // roomServerSubIP = "tcp://192.168.1.125:56991"; - RSclient = gameObject.AddComponent(); - SyncId = syncId; - currentRoomArea = roomArea; - RSclient.Init(roomServerPubIP, roomServerSubIP, roomArea, ReciveFromRoomServerInThread, ReciveFromRoomServerInMono, "roomServer"); - Debug.Log("开启roomServer:" + roomServerPubIP + "------" + roomServerSubIP + "-------" + roomArea); - } - } - - public void RemoveRoomServerClient() - { - if (RSclient != null) - { - RSclient.Destroy(); - // RSclient = null; - Debug.Log("RSclient置空"); - } - } - - /// - /// RoomServer,mono - /// - /// - private void ReciveFromRoomServerInThread(st_Motions stS) - { - //同步域 - if (programState == ProgramState.进行中) - { - if (stS.m_iOperaType == 10006) - { - //单值同步 - int syncid = BitConverter.ToInt32(stS.m_sOperaData, 0); - if (LoadManage.Instance.SyncId != syncid) - { - int legth = BitConverter.ToInt32(stS.m_sOperaData, 4); - string id = Encoding.UTF8.GetString(stS.m_sOperaData, 8, legth); - if (OneValueSyncObject.OneAxisSyncObjectList.ContainsKey(id)) - { - if (stS.m_sOperaData[9 + legth] == 0) - { - //无回调 - OneValueSyncObject.OneAxisSyncObjectList[id].SetValue(8 + legth, stS.m_sOperaData); - } - else - { - //有回调 - RSclient._netMqListener.AddToMono(stS); - } - } - } - } - else if (stS.m_iOperaType == 10007) - { - //坐标角度同步 - int syncid = BitConverter.ToInt32(stS.m_sOperaData, 0); - if (LoadManage.Instance.SyncId != syncid) - { - int legth = BitConverter.ToInt32(stS.m_sOperaData, 4); - string id = Encoding.UTF8.GetString(stS.m_sOperaData, 8, legth); - if (FunctionSync_PositionRoate.positionRoateSyncObejctList.ContainsKey(id)) - { - FunctionSync_PositionRoate.positionRoateSyncObejctList[id].SetValue(8 + legth, stS.m_sOperaData); - } - } - } - else if (stS.m_iOperaType == 61) - { - //心跳检测 - //XinTiaoCheck(); - } - else - { - RSclient._netMqListener.AddToMono(stS); - } - } - } - - /// - /// RoomServer,mono - /// - /// - public void ReciveFromRoomServerInMono(st_Motions data) - { - -#if !UNITY_EDITOR - try - { -#endif - - - switch (data.m_iOperaType) - { - case 16: - { - //结束房间 - if (GameManage.Instance != null) - { - GameManage.Instance.action_close.Invoke(); - } - } - break; - case 25: - { - //二维通信(2维-->3维) - int length = BitConverter.ToInt32(data.m_sOperaData, 0); - string msg = Encoding.UTF8.GetString(data.m_sOperaData, 4, length); - MessageModel messageModel = JsonMapper.ToObject(msg); - if (SoftManage.Instance != null) - { - SoftManage.Instance.SoftHandle(messageModel); - } - } - break; - case 31: - { - //开始暂停 - int length = BitConverter.ToInt32(data.m_sOperaData, 0); - string practiceid = Encoding.UTF8.GetString(data.m_sOperaData, 4, length); - isPause = (data.m_sOperaData[4 + length] == 1 ? false : true); - if (GameManage.Instance.action_Pause != null) - { - GameManage.Instance.action_Pause.Invoke(isPause); - } - } - break; - case 33://得到房间所有数据 - if (programState == ProgramState.进行中) - { - GetRoomData(data.m_sOperaData); - } - break; - case 41: - { - //科目启停 - int length = BitConverter.ToInt32(data.m_sOperaData, 0); - string msg = Encoding.UTF8.GetString(data.m_sOperaData, 4, length); - if (GameManage.Instance != null) - { - GameManage.Instance.SubjectChange(msg); - } - } - break; - case 51: - { - //步骤启停 - int length = BitConverter.ToInt32(data.m_sOperaData, 0); - string msg = Encoding.UTF8.GetString(data.m_sOperaData, 4, length); - if (GameManage.Instance != null) - { - GameManage.Instance.StepChange(msg); - } - } - break; - - - - - - - - case 1000://测试 - - break; - case 10006://单值同步 - if (programState == ProgramState.进行中) - { - int legth = BitConverter.ToInt32(data.m_sOperaData, 4); - string id = Encoding.UTF8.GetString(data.m_sOperaData, 8, legth); - OneValueSyncObject.OneAxisSyncObjectList[id].SetValue(8 + legth, data.m_sOperaData); - OneValueSyncObject.OneAxisSyncObjectList[id].callbackInmono.Invoke(id, false); - } - break; - case 10008://生成物体 - if (programState == ProgramState.进行中) - { - int syncId = BitConverter.ToInt32(data.m_sOperaData, 0); - if (LoadManage.Instance.SyncId != syncId) - { - if (FunctionSync_CreateObejct.Instance != null) - { - FunctionSync_CreateObejct.Instance.CallBack(data.m_sOperaData); - } - } - } - break; - case 10010: - if (programState == ProgramState.进行中) - { - //自己也要执行 - int legth = BitConverter.ToInt32(data.m_sOperaData, 0); - string id = Encoding.UTF8.GetString(data.m_sOperaData, 4, legth); - if (FunctionSync_Media.functionSync_MediaDic.ContainsKey(id)) - { - FunctionSync_Media.functionSync_MediaDic[id].CallBack(data.m_sOperaData); - } - } - break; - } - - - - -#if !UNITY_EDITOR - } - catch (Exception e) - { - Debug.LogError(e.Message); - } -#endif - - } - - - - public void GetRoomData(byte[] data) - { - //索引 - int index = 0; - //暂停 - isPause = (data[0] == 1 ? true : false); - index++; - Debug.Log(isPause ? "暂停" : "开始"); - if (GameManage.Instance.action_Pause != null) - { - GameManage.Instance.action_Pause.Invoke(isPause); - } - - //打分 - int countScore = BitConverter.ToInt32(data, index); - index += 4; - for (int i = 0; i < countScore; i++) - { - //取数据 - int tmpnum = BitConverter.ToInt32(data, index); - index += 4; - byte[] tmp = new byte[tmpnum]; - Array.Copy(data, index, tmp, 0, tmpnum); - index += tmpnum; - //解析 - HandleScore(Encoding.UTF8.GetString(tmp)); - } - - //10008生成 - int countCreate = BitConverter.ToInt32(data, index); - index += 4; - for (int i = 0; i < countCreate; i++) - { - //取数据 - int tmpnum = BitConverter.ToInt32(data, index); - index += 4; - byte[] tmp = new byte[tmpnum]; - Array.Copy(data, index, tmp, 0, tmpnum); - index += tmpnum; - //解析 - FunctionSync_CreateObejct.Instance.CallBack(tmp); - } - //10006单值 - int couOneValue = BitConverter.ToInt32(data, index); - index += 4; - for (int i = 0; i < couOneValue; i++) - { - //取数据 - int tmpnum = BitConverter.ToInt32(data, index); - index += 4; - byte[] tmp = new byte[tmpnum]; - Array.Copy(data, index, tmp, 0, tmpnum); - index += tmpnum; - //解析 - int legth = BitConverter.ToInt32(tmp, 4); - string id = Encoding.UTF8.GetString(tmp, 8, legth); - if (OneValueSyncObject.OneAxisSyncObjectList.ContainsKey(id)) - { - OneValueSyncObject.OneAxisSyncObjectList[id].SetValue(8 + legth, tmp); - if (tmp[9 + legth] == 1) - { - OneValueSyncObject.OneAxisSyncObjectList[id].callbackInmono.Invoke(id, true); - } - } - else - { - Debug.LogError("不存在此物体:" + id); - } - } - - //10007坐标旋转 - int countPosRot = BitConverter.ToInt32(data, index); - index += 4; - for (int i = 0; i < countPosRot; i++) - { - //取数据 - int tmpnum = BitConverter.ToInt32(data, index); - index += 4; - byte[] tmp = new byte[tmpnum]; - Array.Copy(data, index, tmp, 0, tmpnum); - index += tmpnum; - //解析 - int legth = BitConverter.ToInt32(tmp, 4); - string id = Encoding.UTF8.GetString(tmp, 8, legth); - if (FunctionSync_PositionRoate.positionRoateSyncObejctList.ContainsKey(id)) - { - FunctionSync_PositionRoate.positionRoateSyncObejctList[id].SetValue(8 + legth, tmp); - } - } - - Debug.Log("数据已恢复"); - } - - private void HandleScore(string str) - { - var ys = str.Split('|'); - if (ys[0] == "评估点") - { - //评估点 | 科目物体名称 | 评估点序号 | 当前index - ScoreBase sb = GameManage.Instance.scoreManage.transform.Find(ys[1]).GetComponentsInChildren(true).ToList().Find(a => a.code.ToString() == ys[2]); - sb.IsRight = true; - sb.Completed = int.Parse(ys[3]); - } - else if (ys[1] == "操作点") - { - //操作点 | 科目物体名称 | 评估点序号 | 操作点物体名称 | index - ScoreJudge_FixedValue tmp = GameManage.Instance.scoreManage.transform.Find(ys[1]).GetComponentsInChildren(true).ToList().Find(a => a.code.ToString() == ys[2]).transform.Find(ys[3]).GetComponent(); - tmp.Isright = true; - tmp.index = int.Parse(ys[4]); - } - - Debug.Log("打分恢复:" + str); - } - - /// - /// 心跳检测响应 - /// - public void XinTiaoCheck() - { - if (programState == ProgramState.进行中 && LoadManage.Instance != null && !string.IsNullOrEmpty(LoadManage.Instance.MyId) && !string.IsNullOrEmpty(LoadManage.Instance.currentRoomArea)) - { - if (GameManage.Instance != null) - { - UnityEngine.Debug.Log("重置6秒"); - GameManage.Instance.checkTime = 6; - } - byte[] tmp = Encoding.UTF8.GetBytes(LoadManage.Instance.MyId); - byte[] data = new byte[4 + tmp.Length]; - Array.Copy(BitConverter.GetBytes(tmp.Length), 0, data, 0, 4); - Array.Copy(tmp, 0, data, 4, tmp.Length); - RSclient.Send(LoadManage.Instance.currentRoomArea, 6, data); - Debug.Log("心跳" + LoadManage.Instance.currentRoomArea); - } - } - - //public void StartRoom(string roomid) - //{ - // byte[] roomidbytes = Encoding.UTF8.GetBytes(roomid); - // byte[] tmp = new byte[4 + roomidbytes.Length]; - // Array.Copy(BitConverter.GetBytes(roomidbytes.Length), 0, tmp, 0, 4); - // Array.Copy(roomidbytes, 0, tmp, 4, roomidbytes.Length); - // MSclient.Send("mainServer", 100, tmp); - // Debug.Log("启动房间:" + roomidbytes); - //} - //public void CloseRoom(string roomId, string pcArea, string roomArea) - //{ - // //string roomId = "abcdasdadasd"; - // byte[] roomidbytes = Encoding.UTF8.GetBytes(roomId); - // //string pcArea = "pcserver125"; - // byte[] pcbytes = Encoding.UTF8.GetBytes(pcArea); - // //string roomArea = "room1"; - // byte[] roombytes = Encoding.UTF8.GetBytes(roomArea); - // byte[] tmp = new byte[12 + roomidbytes.Length + pcbytes.Length + roombytes.Length]; - // Array.Copy(BitConverter.GetBytes(roomidbytes.Length), 0, tmp, 0, 4); - // Array.Copy(roomidbytes, 0, tmp, 4, roomidbytes.Length); - // Array.Copy(BitConverter.GetBytes(pcbytes.Length), 0, tmp, 4 + roomidbytes.Length, 4); - // Array.Copy(pcbytes, 0, tmp, 8 + roomidbytes.Length, pcbytes.Length); - // Array.Copy(BitConverter.GetBytes(roombytes.Length), 0, tmp, 8 + roomidbytes.Length + pcbytes.Length, 4); - // Array.Copy(roombytes, 0, tmp, 12 + roomidbytes.Length + pcbytes.Length, roombytes.Length); - // MSclient.Send("mainServer", 110, tmp); - // Debug.Log("关闭房间:" + roomId); - //} - - private void OnDestroy() - { - Debug.Log("OnDestroy"); - udpRun = false; - if (RSclient != null) - { - RSclient.Destroy(); - } - - if (udpClient != null) - { - udpClient.Close(); - } - } -} - -public enum SystemMode -{ - PC, - MR -} \ No newline at end of file diff --git a/Assets/Zion/Scripts/manage/LoadManage.cs.meta b/Assets/Zion/Scripts/manage/LoadManage.cs.meta deleted file mode 100644 index e6ce7b1a..00000000 --- a/Assets/Zion/Scripts/manage/LoadManage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3f7e635459b7b2a42b6de90ffc7b273a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/manage/MyClass.cs b/Assets/Zion/Scripts/manage/MyClass.cs index 02bf69b9..310cff17 100644 --- a/Assets/Zion/Scripts/manage/MyClass.cs +++ b/Assets/Zion/Scripts/manage/MyClass.cs @@ -188,3 +188,7 @@ public class AuthReq public string userName; } +public class DisplayOnly : PropertyAttribute +{ + +} diff --git a/Assets/Zion/Scripts/manage/MyNetMQClient.cs b/Assets/Zion/Scripts/manage/MyNetMQClient.cs deleted file mode 100644 index de01628a..00000000 --- a/Assets/Zion/Scripts/manage/MyNetMQClient.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System; -using System.Collections.Concurrent; -using System.Linq; -using System.Diagnostics; -using UnityEngine.Networking; -using DataModel.Model; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Threading; - -public class MyNetMQClient : MonoBehaviour -{ - public static MyNetMQClient instance; - [DisplayOnly] - public string PubIP= "127.0.0.1:8082"; - [DisplayOnly] - public string SubIP = "127.0.0.1:8081"; - - /// - /// 接口IP (配置文件) - /// - public static string CallIP = "192.168.0.103:8080"; - public static string SyncServerIP = "192.168.0.103:8888"; - public static string remoteServerIP = "192.168.0.103:8890"; - public static string userIP = "192.168.0.102"; - - [HideInInspector] - public NetMqListener _netMqListener; - [HideInInspector] - public NetMqPublisher _netMqPublisher; - - - - private void Awake() - { - instance = this; - } - - /// - /// 初始化Netmq - /// - /// 接收函数 - public void Init(string ServerSubIP,string ServerPubIP,string area, NetMqListener.ReciveMessageInThread reciveInthread, NetMqListener.ReceiceMessageInMono reciveInMono,string typename) - { - SubIP = ServerSubIP; - PubIP = ServerPubIP; - //开启接收模块 - _netMqListener = new NetMqListener(ServerSubIP, area, reciveInthread, reciveInMono); - _netMqListener.typeName = typename; - //开启发送模块 - _netMqPublisher = new NetMqPublisher(ServerPubIP); - _netMqPublisher.typeName = typename; - } - - public void Send(string area,int type,byte[] data) - { - _netMqPublisher.AddMessageToSendQue(area, type, data); - } - public void Send(st_Motions st) - { - _netMqPublisher.AddMessageToSendQue(st); - } - - private void Update() - { - if (_netMqListener != null) - { - _netMqListener.UpdateByte(); - } - - //测试 - //if(Input.GetKeyDown(KeyCode.Space)) - //{ - // Send(LoadManage.Instance.currentPractice.RoomArea, 1000, new byte[5]); - //} - } - - public void Destroy() - { - _netMqListener._listenerCancelled = true; - _netMqPublisher._listenerCancelled = true; - UnityEngine.Debug.Log("销毁xxxxx"); - Destroy(this); - } - - - #region 调接口 - /// - /// 调接口 - /// - /// - /// - /// - /// - public static IEnumerator CallPost(string url, KeyValuePair[] datas, Action back) - { - WWWForm form = new WWWForm(); - for (int i = 0; i < datas.Length; i++) - { - form.AddField(datas[i].Key, datas[i].Value); - } - UnityWebRequest request = UnityWebRequest.Post(url, form); - yield return request.SendWebRequest(); - if (request.isDone) - { - if (request.isHttpError || request.isNetworkError) - { - MessagePanel.ShowMessage("接口异常,isHttpError"+ request.isHttpError+ ".isNetworkError"+ request.isNetworkError, GameObject.FindObjectOfType().transform); - } - else - { - if (back != null) - { - back.Invoke(request.downloadHandler.text); - } - } - } - } - /// - /// 调接口 - /// - /// - /// - /// - public static IEnumerator CallGet(string url, Action back) - { - UnityWebRequest request =UnityWebRequest.Get(url); - yield return request.SendWebRequest(); - if (request.isDone) - { - if (request.isHttpError || request.isNetworkError) - { - MessagePanel.ShowMessage("接口异常+isHttpError"+ request.isHttpError+ ",isNetworkError"+ request.isNetworkError, GameObject.FindObjectOfType().transform); - } - else - { - if (back != null) - { - back.Invoke(request.downloadHandler.text); - } - } - } - } - - public static IEnumerator GetFile(string url,Action back) - { - UnityWebRequest request = UnityWebRequest.Get(url); - yield return request.SendWebRequest(); - if (request.isDone) - { - if (request.isHttpError || request.isNetworkError) - { - MessagePanel.ShowMessage("接口异常+isHttpError" + request.isHttpError + ",isNetworkError" + request.isNetworkError, GameObject.FindObjectOfType().transform); - } - else - { - if (back != null) - { - back.Invoke(request.downloadHandler.data); - } - } - } - } - - /// - /// 调用web接口(PostUploadHandler) - /// - /// - /// 数据 - /// 回调 - /// - public static IEnumerator InvokeWebPostByUploadhandler(string url, string json, Action callback) - { - byte[] uploadData = Encoding.UTF8.GetBytes(json); - UnityWebRequest webRequest = new UnityWebRequest(url, "POST"); - webRequest.SetRequestHeader("accept", "*/*"); - webRequest.SetRequestHeader("contentType", "application/json"); - webRequest.downloadHandler = new DownloadHandlerBuffer(); - webRequest.uploadHandler = new UploadHandlerRaw(uploadData); - - yield return webRequest.SendWebRequest(); - if (webRequest.isHttpError || webRequest.isNetworkError) - { - callback(false,webRequest.error); - } - else - { - callback(true,webRequest.downloadHandler.text); - } - } - - /// - /// 上传文件 - /// - /// - /// - /// - /// - /// - public static IEnumerator UpLoadFile(string url,byte[] file,string fileName,Action back) - { - WWWForm form = new WWWForm(); - form.AddField("action", "Add"); - form.AddField("saveName", fileName); - form.AddBinaryData("file", file); - - UnityWebRequest request = UnityWebRequest.Post(url, form); - yield return request.SendWebRequest(); - if (request.isDone) - { - if (request.isHttpError || request.isNetworkError) - { - MessagePanel.ShowMessage("接口异常,isHttpError" + request.isHttpError + ".isNetworkError" + request.isNetworkError, GameObject.FindObjectOfType().transform); - back(new CallResultObject { state = false }); - } - else - { - if (back != null) - { - string str=request.downloadHandler.text; - CallResultObject co= LitJson.JsonMapper.ToObject(str); - back.Invoke(co); - } - } - } - else - { - back(new CallResultObject { state = false }); - } - } - #endregion -} - - - - - -/// -/// 消息体 -/// -[Serializable] -public struct st_Motions -{ - /// - /// 域 - /// - public string area; - /// - /// 消息标识 - /// - public int m_iOperaType; - /// - /// 消息内容(byte[256]) - /// - public byte[] m_sOperaData; -} - -/// -/// 演习状态 -/// -public enum ProgramState -{ - 结束, - 进行中 -} diff --git a/Assets/Zion/Scripts/manage/MyNetMQClient.cs.meta b/Assets/Zion/Scripts/manage/MyNetMQClient.cs.meta deleted file mode 100644 index abeac2c6..00000000 --- a/Assets/Zion/Scripts/manage/MyNetMQClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a370c39ec00727e4ba3b391f3e7ea4ca -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/manage/ScoreManage.cs b/Assets/Zion/Scripts/manage/ScoreManage.cs deleted file mode 100644 index 6875273e..00000000 --- a/Assets/Zion/Scripts/manage/ScoreManage.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System.Xml; -using System.Linq; -using System.IO; -using LitJson; -using DataModel.Model; - -public class ScoreManage : MonoBehaviour -{ - /// - /// 配置xml - /// - public static XmlDocument scoreXML; - - public List scoreList; - - public void Init() - { - //初始化所有socreobject - scoreList = GetComponentsInChildren(true).ToList(); - scoreList.ForEach(a => - { - if (LoadManage.Instance.psubjects.Any(b => a.transform.parent.name == b.Name)) - { - a.Init(a.transform.parent.name, a.code); - } - }); - } - - /// - /// 提交总表成绩 - /// - public void SubmitApprise(string subjectname) - { - practicesubject tmpps = LoadManage.Instance.psubjects.Find(a => a.Name == subjectname); - appraise appraise = new appraise - { - Id = LoadManage.Instance.currentPractice.Id, - PracticeId= LoadManage.Instance.currentPractice.Id, - SubjectId = tmpps.SubjectId, - PracticeSubjectId= tmpps.Id, - AppraiseName = tmpps.Name, - HardLevel= tmpps.HardLevel, - }; - - //提交数据库 - string url = "http://" + MyNetMQClient.CallIP + "/Handler/Api_Appraise.ashx"; - var tmp = new KeyValuePair[2]; - tmp[0] = new KeyValuePair("action", "setScore"); - tmp[1] = new KeyValuePair("appraise", JsonMapper.ToJson(appraise)); - StartCoroutine(MyNetMQClient.CallPost(url, tmp, result => - { - var json = JsonMapper.ToObject(result); - if (json.state) - { - Debug.Log("上传总表:++++++++++++++++++++++++++++++" + JsonMapper.ToJson(appraise)); - } - else - { - Debug.Log(json.message); - } - })); - } - - - /// - /// 读xml - /// - /// - public static void SetXml (string text) - { - scoreXML = new XmlDocument(); - - StringReader stringReader = new StringReader(text); - stringReader.Read(); - string str = stringReader.ReadToEnd(); - stringReader.Close(); - - scoreXML.LoadXml(str); - Debug.Log("考核xml加载成功"); - } -} - -public enum ScoreType -{ - 无序, - 有序 -} diff --git a/Assets/Zion/Scripts/manage/ScoreManage.cs.meta b/Assets/Zion/Scripts/manage/ScoreManage.cs.meta deleted file mode 100644 index 124a005e..00000000 --- a/Assets/Zion/Scripts/manage/ScoreManage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d28cac3e38d3916458b496b4283514cc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Zion/Scripts/manage/SoftManage.cs b/Assets/Zion/Scripts/manage/SoftManage.cs deleted file mode 100644 index 7ae8ee36..00000000 --- a/Assets/Zion/Scripts/manage/SoftManage.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using System.Net; -using System.Text; -using System.Linq; - -public class SoftManage : MonoBehaviour -{ - public static SoftManage Instance; - public string softName = "车控软件"; - - Dictionary subjectDic = new Dictionary {}; - - - private Action softAction; - - /// - /// 配置文件 科目=软件&岗位,软件&岗位 - /// - private Dictionary> softseting; - - //public List Soft = new List();//操作软件通信 - private void Awake() - { - Instance = this; - subjectDic.Add("转载下车前准备", "3cbb773a-3cb3-43bb-9aa1-8e3bb00c8aeb"); - subjectDic.Add("转载下车后撤收", "657e1b34-7a74-401d-a5e6-efcb0275e520"); - subjectDic.Add("转载上车前准备", "672b234e-9eee-4de7-989b-3a1df41eb05e"); - subjectDic.Add("转载上车后撤收", "1461f02f-d436-4e42-b8ca-6587c5c38f49"); - - //读配置文件 - StartCoroutine(MyNetMQClient.CallGet("http://"+ MyNetMQClient.CallIP + "/3DConfig/SoftSetting.txt", str => - { - var tmps=str.Split(new char[] {'\r','\n' }, StringSplitOptions.RemoveEmptyEntries).ToList(); - var tmpdic =new Dictionary>(); - tmps.ForEach(a=> - { - string[] p=a.Split('='); - string[] datas=p[1].Split(','); - - List ruanjianlist = new List(); - for (int i = 0; i < datas.Length; i++) - { - ruanjianlist.Add(datas[i].Split('&')); - } - tmpdic.Add(p[0], ruanjianlist); - }); - - softseting = tmpdic; - })); - } - - private void Start() - { - ////连接仿真服务器 - //ClientSocket.ConnectFangZhenSocekt(LoadManage.Instance.currentPractice.IpAddress, LoadManage.Instance.currentPractice.Port.Value, (a) => - //{ - // if (!a) - // { - // Debug.LogError("连接仿真服务器失败"); - // MessagePanel.ShowMessage("连接仿真服务器失败", GameManage.Instance.canvas.transform, b => { }); - // } - //}); - } - - private void Update() - { - //测试代码 - //if (Input.GetKeyDown(KeyCode.Space)) - //{ - // LoadManage.Instance.currentPracticeSubejct = LoadManage.Instance.psubjects[0]; - // LoadManage.Instance.currentPracticeSeat = LoadManage.Instance.myPracticeSeat.Find(a => a.PracticeSubjectId == LoadManage.Instance.currentPracticeSubejct.Id); - // StartSoft(LoadManage.Instance.currentPracticeSeat.PracticeId, LoadManage.Instance.currentPracticeSubejct.Name, LoadManage.Instance.currentPracticeSeat.SeatName, LoadManage.Instance.currentPracticeSeat.UserAccount, 0); - //} - - //if (Soft.Any()) - //{ - // var tmps = Soft.GetRange(0, Soft.Count); - // tmps.ForEach(tmp => - // { - // SoftHandle(tmp); - // }); - // Soft.Clear(); - //} - } - - /// - /// 注册软件消息处理函数 - /// - /// 参数(消息内容,软件名) - public void SetSoftAction(Action softAction) - { - this.softAction += softAction; - } - - /// - /// 二维软件消息处理 - /// - public void SoftHandle(MessageModel message) - { - if (softAction != null) - { - softAction.Invoke(message.str, message.canShu.ToString()); - } - } - - /// - /// 是否自己执行 - /// - /// - /// - public bool CanHandle(string softName) - { - if (LoadManage.Instance.currentPracticeSubejct!=null && LoadManage.Instance.currentPracticeSeat!=null) - { - string subjectname = LoadManage.Instance.currentPracticeSubejct.Name; - string seatname=LoadManage.Instance.currentPracticeSeat.SeatName; - if (softseting.ContainsKey(subjectname)) - { - if (softseting[subjectname].Any(a => a[0] == softName && a[1] == seatname)) - { - return true; - } - } - } - - return false; - } - private void OnDestroy() - { - softAction = null; - ClientSocket.CloseFangZhenSocket(); - } - - /// - /// 启动二维软件 (故障课目为1,非故障为0) - /// - public void StartSoft(string pratcieId, string subjectName, string seatName, string userAccount, int isGuZhang) - { - //是否开启软件 - if(softseting.ContainsKey(subjectName) && softseting[subjectName].Any(a=>a[0]==softName && a[1]==seatName)) - { - if (subjectDic.ContainsKey(subjectName)) - { - string subjectId = subjectDic[subjectName]; - Debug.Log("启动二维软件"); - string arguments = string.Format("{0};{1};{2};{3};{4};{5};{6};{7}", pratcieId, subjectId, seatName, userAccount, LoadManage.Instance.currentPractice.IpAddress, LoadManage.Instance.currentPractice.Port, isGuZhang, "none:no"); - - byte[] arg = Encoding.UTF8.GetBytes(arguments); - byte[] data = new byte[8 + arg.Length]; - //type - Array.Copy(BitConverter.GetBytes(20), 0, data, 0, 4); - //参数 - Array.Copy(BitConverter.GetBytes(arg.Length), 0, data, 4, 4); - Array.Copy(arg, 0, data, 8, arg.Length); - - //UDP远程启动 - LoadManage.Instance.UdpSend(data, new IPEndPoint(IPAddress.Parse(MyNetMQClient.remoteServerIP.Split(':')[0]), int.Parse(MyNetMQClient.remoteServerIP.Split(':')[1]))); - } - } - } - - /// - /// 远程切换科目 - /// - public void ChangeSoftSubject(string practiceId, string subjectName, string softName, string seatName, string userAccount) - { - if (subjectDic.ContainsKey(subjectName)) - { - string subejctId = subjectDic[subjectName]; - MessageModel messageModel = new MessageModel(SimOperationEnum.操作软件三维端); - messageModel.str = string.Format("{0}|{1}|{2}|{3}|{4}", "切换科目", practiceId, subejctId, seatName, userAccount); - - messageModel.str2 = MyNetMQClient.remoteServerIP.Split(':')[0]; - - messageModel.canShu = softName; - // ClientSocket.SendToTongBuFangZhenServer(messageModel); - - string msg=LitJson.JsonMapper.ToJson(messageModel); - byte[] msgbytes=Encoding.UTF8.GetBytes(msg); - - byte[] tmps = new byte[4+msgbytes.Length]; - Array.Copy(BitConverter.GetBytes(msg.Length), 0, tmps, 0, 4); - Array.Copy(msgbytes, 0, tmps, 4, msgbytes.Length); - MyNetMQClient.instance.Send(LoadManage.Instance.currentRoomArea, 22, tmps); - Debug.Log("切换二维软件科目:" + subjectName); - } - else - { - Debug.LogError("不存在此二维科目"); - } - } -} diff --git a/Assets/Zion/Scripts/manage/SoftManage.cs.meta b/Assets/Zion/Scripts/manage/SoftManage.cs.meta deleted file mode 100644 index cbb2fbee..00000000 --- a/Assets/Zion/Scripts/manage/SoftManage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04be3a7af5c7f6248b37407b9f3f85b1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: