mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 00:15:39 +03:00
06.07.2022
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -266,273 +265,4 @@ public class ChangeSystem : MonoBehaviour
|
||||
//}).catch ((message) => {
|
||||
// alert(message);
|
||||
//});
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ChangeSystem : MonoBehaviour
|
||||
{
|
||||
public GameObject AllSystemsBtn;
|
||||
public GameObject ButtonMainBack;
|
||||
|
||||
public GameObject MasloBtn;
|
||||
public GameObject MasloBtnBackOff;
|
||||
|
||||
public GameObject OstanovBtn;
|
||||
public GameObject OstanovBtnBackOff;
|
||||
|
||||
public GameObject TormozBtn;
|
||||
public GameObject TormozBtnBackOff;
|
||||
|
||||
public GameObject DrenazhDvigBtn;
|
||||
public GameObject DrenazhDvigBtnBackOff;
|
||||
|
||||
public GameObject ToplBtn;
|
||||
public GameObject ToplBtnBackOff;
|
||||
|
||||
public GameObject GidroBtn;
|
||||
public GameObject GidroBtnBackOff;
|
||||
|
||||
public GameObject TransBtn;
|
||||
public GameObject TransBtnBackOff;
|
||||
|
||||
public GameObject PozharBtn;
|
||||
public GameObject PozharBtnBackOff;
|
||||
|
||||
public GameObject POSBtn;
|
||||
public GameObject POSBtnBackOff;
|
||||
|
||||
public GameObject UprDvigBtn;
|
||||
public GameObject UprDvigBtnBackOff;
|
||||
|
||||
public GameObject ZapuskDvigBtn;
|
||||
public GameObject ZapuskDvigBtnBackOff;
|
||||
|
||||
public GameObject TV117VBtn;
|
||||
public GameObject TV117VBtnBackOff;
|
||||
|
||||
public GameObject TA14Btn;
|
||||
public GameObject TA14BtnBackOff;
|
||||
|
||||
public GameObject UPRStabBtn;
|
||||
public GameObject UPRStabBtnBackOff;
|
||||
|
||||
public GameObject SKVBtn;
|
||||
public GameObject SKVBtnBackOff;
|
||||
|
||||
public GameObject PutevBtn;
|
||||
public GameObject PutevBtnBackOff;
|
||||
|
||||
public GameObject ProdolBtn;
|
||||
public GameObject ProdolBtnBackOff;
|
||||
|
||||
public GameObject OSHBtn;
|
||||
public GameObject OSHBtnBackOff;
|
||||
|
||||
public GameObject OhlAgrBtn;
|
||||
public GameObject OhlAgrBtnBackOff;
|
||||
|
||||
public GameObject KislorodBtn;
|
||||
public GameObject KislorodBtnBackOff;
|
||||
|
||||
public Camera MainCamera;
|
||||
public Camera CamMasloSystem, CamOstanov, CamUpravDvig, CamPOS, CamTrans, CamFire, CamTopl, CamTormoz,
|
||||
CamGidro, CamZapuskDvig, CamDrenazhDvig, CamTV117V, CamTA14, CamUPRStab, CamSKV, CamPutev, CamProdol, CamOSH, CamOhlAgr, CamKislorod;
|
||||
|
||||
//string Maslo = "CamMasloSystem";
|
||||
|
||||
public void ChooseSys(string MySystem)
|
||||
{
|
||||
if (!MySystem.ToLower().StartsWith("system_")) return;
|
||||
int N = 0;
|
||||
if (!int.TryParse(MySystem.ToLower().Replace("system_", ""), out N)) return;
|
||||
if (N == 1) //"AllSystems"
|
||||
{
|
||||
AllSystemsBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//ButtonMainBack.SetActive(false);
|
||||
}
|
||||
if (N == 2) //"MasloSystem"
|
||||
{
|
||||
MasloBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//MasloBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 3) //"OstanovSystem"
|
||||
{
|
||||
OstanovBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//OstanovBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 4) //"TormozSystem"
|
||||
{
|
||||
TormozBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//TormozBtnBackOff.SetActive(false);
|
||||
GameObject.Find("IFM").SetActive(false);
|
||||
GameObject.Find("Air").SetActive(false);
|
||||
}
|
||||
if (N == 5) //"DrenazhSystem"
|
||||
{
|
||||
DrenazhDvigBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//DrenazhDvigBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 6) //"ToplSystem"
|
||||
{
|
||||
ToplBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//ToplBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 7) //"GidroSystem"
|
||||
{
|
||||
GidroBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//GidroBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 8) //"TransSystem"
|
||||
{
|
||||
TransBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//TransBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 9) //"PozharSystem"
|
||||
{
|
||||
PozharBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//PozharBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 10) //"POSSystem"
|
||||
{
|
||||
POSBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//POSBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 11) //"UprDvigSystem"
|
||||
{
|
||||
UprDvigBtn.GetComponent<Button>().onClick.Invoke();
|
||||
UprDvigBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 12) //"ZapuskDvigSystem"
|
||||
{
|
||||
ZapuskDvigBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//ZapuskDvigBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 13) //"TV117VSystem"
|
||||
{
|
||||
TV117VBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//TV117VBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 14) //"TA14BtnSystem"
|
||||
{
|
||||
TA14Btn.GetComponent<Button>().onClick.Invoke();
|
||||
//TA14BtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 15) //"UPRStabSystem"
|
||||
{
|
||||
UPRStabBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//UPRStabBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 16) //"SKVSystem"
|
||||
{
|
||||
SKVBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//SKVBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 17) //"PutevSystem"
|
||||
{
|
||||
PutevBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//PutevBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 18) //"ProdolSystem"
|
||||
{
|
||||
ProdolBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//ProdolBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 19) //"OSHSystem"
|
||||
{
|
||||
OSHBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//OSHBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 20) //"OhlAgrSystem"
|
||||
{
|
||||
OhlAgrBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//OhlAgrBtnBackOff.SetActive(false);
|
||||
}
|
||||
if (N == 21) //"KislorodSystem"
|
||||
{
|
||||
KislorodBtn.GetComponent<Button>().onClick.Invoke();
|
||||
//KislorodBtnBackOff.SetActive(false);
|
||||
}
|
||||
|
||||
////MasloSystem = GameObject.Find("CamMasloSystem");
|
||||
//GameObject[] Maslomassiv = GameObject.FindGameObjectsWithTag("MasloSystem");
|
||||
//foreach (GameObject Maslo in Maslomassiv)
|
||||
//{
|
||||
// Transform[] childs = Maslo.GetComponentsInChildren<Transform>();
|
||||
// foreach (Transform Maslochild in childs)
|
||||
// {
|
||||
// if (Maslochild.gameObject.name.StartsWith("Button2"))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// Maslochild.gameObject.SetActive(true);
|
||||
// Maslochild.gameObject.GetComponent<Button>() //button.onClick.Invoke(); //îøèáêà
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public void SwitchOffAllCams()
|
||||
{
|
||||
CamMasloSystem.enabled = false; CamOstanov.enabled = false; CamUpravDvig.enabled = false;
|
||||
CamPOS.enabled = false; CamTrans.enabled = false; CamFire.enabled = false;
|
||||
CamTopl.enabled = false; CamTormoz.enabled = false; CamGidro.enabled = false;
|
||||
CamZapuskDvig.enabled = false; CamDrenazhDvig.enabled = false; CamTV117V.enabled = false;
|
||||
CamTA14.enabled = false; CamUPRStab.enabled = false; CamSKV.enabled = false;
|
||||
CamPutev.enabled = false; CamProdol.enabled = false; CamOSH.enabled = false;
|
||||
CamOhlAgr.enabled = false; CamKislorod.enabled = false;
|
||||
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("FuzCompLayer");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Ostanov");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Maslosistema");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("UpravlenieDvig");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("POS");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Transmission");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Pozhar");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Toplivo");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("TormozNV");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Gidro");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("ZapuskDvig");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("DrenazhDvig");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("TV117V");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("TA14");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("UPRStab");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("SKV");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Putev");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Prodol");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("OSH");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("OhlAgr");
|
||||
MainCamera.cullingMask |= 1 << LayerMask.NameToLayer("Kislorod");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//var script = document.createElement("script");
|
||||
//script.src = loaderUrl;
|
||||
//script.onload = () => {
|
||||
// createUnityInstance(canvas, config, (progress) => {
|
||||
// progressBarFull.style.width = 100 * progress + "%";
|
||||
// }).then((unityInstance) => {
|
||||
// loadingBar.style.display = "none";
|
||||
|
||||
// let timerId = setTimeout(function trySendMsg()
|
||||
|
||||
// {
|
||||
// if (unityInstance.progress = 1)
|
||||
// unityInstance.SendMessage('Obzor', 'ChooseSys', 'OstanovSystem');
|
||||
// else
|
||||
// timerId = setTimeout(trySendMsg, 1000);
|
||||
// }, 1000);
|
||||
|
||||
// fullscreenButton.onclick = () => {
|
||||
// unityInstance.SetFullscreen(1);
|
||||
// };
|
||||
//}).catch ((message) => {
|
||||
// alert(message);
|
||||
//});
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
//};
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -110,116 +109,3 @@ public class mfiArrowNumber : MonoBehaviour
|
||||
ChangeNumber();
|
||||
}
|
||||
}
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using TMPro;
|
||||
using System;
|
||||
|
||||
public class mfiArrowNumber : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private int[] rangeColor; //массив int с кратностью 5 {min на шкале (цифрами int), max на шкале (цифрами int), min на слайдере (цифрами int), max на слайдере (цифрами int), для удобства форматирования}
|
||||
private string formatText = "{0}";
|
||||
private TextMeshPro _number;
|
||||
private Handler _arrow;
|
||||
[SerializeField]
|
||||
//private bool _float = false;
|
||||
void Awake()
|
||||
{
|
||||
Init();
|
||||
ChangeNumber();
|
||||
}
|
||||
void Init() // так надо. Awake не всегда вызывается до начала работы с объектом
|
||||
{
|
||||
_number = GetComponentInParent<TextMeshPro>();
|
||||
_arrow = GetComponent<Handler>();
|
||||
}
|
||||
private void ChangeIndicator(float val)
|
||||
{
|
||||
float num = TransformAngleToState(val);
|
||||
if(_number != null)
|
||||
_number.text = string.Format(formatText, (int)Mathf.Round(num));
|
||||
}
|
||||
public void ChangeNumber()
|
||||
{
|
||||
if (_arrow == null) Init();
|
||||
ChangeIndicator(_arrow.currentAngle);
|
||||
}
|
||||
// На случай вращения против часовой
|
||||
/* static void Swap<T>(ref T lhs, ref T rhs)
|
||||
{
|
||||
T temp;
|
||||
temp = lhs;
|
||||
lhs = rhs;
|
||||
rhs = temp;
|
||||
}*/
|
||||
public float TransformAngleToState(float val)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < rangeColor.Length / 5; i++)
|
||||
{
|
||||
int min = rangeColor[count++];
|
||||
int max = rangeColor[count++];
|
||||
int kmin = rangeColor[count++];
|
||||
int kmax = rangeColor[count++];
|
||||
count++;
|
||||
//if (max < min) Swap(ref max, ref min); //На случай вращения против часовой
|
||||
//Debug.Log($"min = {min}, max = {max}, kmin = {kmin}, kmax = {kmax}");
|
||||
if ((val >= kmin && val <= kmax) || (count >= rangeColor.Length))
|
||||
{
|
||||
float coef = (max - min + 0f) / (kmax - kmin);
|
||||
float num = (val - kmin) * coef + min;
|
||||
if ((val <= (kmax + 1) && val >= (kmax - 1)) || num > max)
|
||||
{
|
||||
num = max;
|
||||
}
|
||||
else if (val < rangeColor[2])
|
||||
{
|
||||
num = rangeColor[0];
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
public float TransformStateToAngle(int val)
|
||||
{
|
||||
if (_arrow == null) Init();
|
||||
float newstate = val;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < rangeColor.Length / 5; i++)
|
||||
{
|
||||
int min = rangeColor[count++];
|
||||
int max = rangeColor[count++];
|
||||
int kmin = rangeColor[count++];
|
||||
int kmax = rangeColor[count++];
|
||||
count++;
|
||||
if ((val >= min && val <= max)) //|| (count >= rangeColor.Length)
|
||||
{
|
||||
float coef = (kmax - kmin + 0f) / (max - min);
|
||||
newstate = (val - min) * coef + kmin;
|
||||
if ((val <= (max + 1) && val >= (max - 1)) || newstate > kmax)
|
||||
{
|
||||
newstate = kmax;
|
||||
}
|
||||
else if (val < rangeColor[2])
|
||||
{
|
||||
newstate = rangeColor[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return newstate;
|
||||
}
|
||||
|
||||
public void setState(float newstate) {
|
||||
_arrow.currentAngle = newstate;
|
||||
ChangeNumber();
|
||||
}
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
@@ -10797,11 +10797,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1036527912875768121}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
<<<<<<< HEAD
|
||||
m_LocalPosition: {x: 0.925, y: 0.21, z: -1}
|
||||
=======
|
||||
m_LocalPosition: {x: 0.925, y: 0.21, z: 0}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
m_LocalScale: {x: 0.7, y: 0.7, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4790444141562044227}
|
||||
@@ -23893,11 +23889,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2442980966293290867}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
<<<<<<< HEAD
|
||||
m_LocalPosition: {x: 0.905, y: 1.43, z: -1}
|
||||
=======
|
||||
m_LocalPosition: {x: 0.905, y: 1.43, z: 0}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
m_LocalScale: {x: 0.9, y: 0.9, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 6205792711220792129}
|
||||
@@ -29512,7 +29504,7 @@ RectTransform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3032182186520411513}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3305564199720297863}
|
||||
@@ -38255,11 +38247,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3871349747585684964}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
<<<<<<< HEAD
|
||||
m_LocalPosition: {x: 0.905, y: 1.77, z: -1}
|
||||
=======
|
||||
m_LocalPosition: {x: 0.905, y: 1.77, z: 0}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
m_LocalScale: {x: 0.9, y: 0.9, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4838764527194494006}
|
||||
@@ -45415,11 +45403,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4701960777638634100}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
<<<<<<< HEAD
|
||||
m_LocalPosition: {x: 0.901, y: 1.14, z: -1}
|
||||
=======
|
||||
m_LocalPosition: {x: 0.901, y: 1.14, z: 0}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
m_LocalScale: {x: 0.8, y: 0.8, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 2877662115602588157}
|
||||
@@ -83341,11 +83325,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8605012324018136611}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
<<<<<<< HEAD
|
||||
m_LocalPosition: {x: 0.893, y: 2.07, z: -1}
|
||||
=======
|
||||
m_LocalPosition: {x: 0.893, y: 2.07, z: 0}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
m_LocalScale: {x: 0.81, y: 0.83, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 31168962564789831}
|
||||
@@ -88644,11 +88624,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9045570649270983783}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
<<<<<<< HEAD
|
||||
m_LocalPosition: {x: 0.9, y: 0.87, z: -1}
|
||||
=======
|
||||
m_LocalPosition: {x: 0.9, y: 0.87, z: 0}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
m_LocalScale: {x: 0.17, y: 0.17, z: 0.2}
|
||||
m_Children:
|
||||
- {fileID: 7086154332574356283}
|
||||
|
||||
@@ -494712,7 +494712,7 @@ MonoBehaviour:
|
||||
viewCamera: {fileID: 781123514}
|
||||
cabinCamera: {fileID: 963194225}
|
||||
ViewBackButton: {fileID: 1232500887}
|
||||
mode: play
|
||||
mode: free
|
||||
viewmode: 1
|
||||
is3D: 0
|
||||
isInitiated: 0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -761,765 +760,3 @@ public class Manager : MonoBehaviour
|
||||
|
||||
|
||||
}
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.EventSystems;
|
||||
using System;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Manager : MonoBehaviour
|
||||
{
|
||||
public Mi38Objects objects = new Mi38Objects();
|
||||
public Player player;
|
||||
public GameObject copter;
|
||||
public GameObject cabines2d;
|
||||
public GameObject canvas;
|
||||
public GameObject fusel;
|
||||
public GameObject copterProz;
|
||||
public GameObject skv;
|
||||
public GameObject air;
|
||||
public GameObject menuPlayButtons;
|
||||
public GameObject viewCamera, cabinCamera;
|
||||
GameObject pilotcabin;
|
||||
GameObject passcabin;
|
||||
GameObject externalpanels;
|
||||
GameObject backBtn;
|
||||
public GameObject ViewBackButton;
|
||||
Transform allPanelsInCanvas;
|
||||
public string mode = "view"; // free, view, scedit, play
|
||||
public int viewmode; // 1 кабина пилотов, 2 пассажирский отсек , 3 снаружи вертолета
|
||||
public bool is3D; // Находимся мы в 2D режиме или 3D
|
||||
public bool isInitiated = false;
|
||||
public bool isPanelsActivated = false;
|
||||
public bool isMouseOverUI = false;
|
||||
[HideInInspector] public bool isProgressBarChangingInProgress = false;
|
||||
hintUI menuViewButton, menuCabinButton, menuPassButton;
|
||||
[HideInInspector] Camera mfi1_cam, mfi2_cam, mfi3_cam, mfi4_cam, mfi5_cam;
|
||||
|
||||
|
||||
Dictionary<string, GameObject> panel3D = new Dictionary<string, GameObject>(); // Панели 3D
|
||||
public Dictionary<string, Panel2D> panel2D = new Dictionary<string, Panel2D>(); // Панели 2D
|
||||
|
||||
//public Dictionary<string, string> allPanelsStatesList = new Dictionary<string, string>(); //Словарь соответствия панелей 2D и 3D
|
||||
public Dictionary<GameObject, GameObject> allPanelsStatesList = new Dictionary<GameObject, GameObject>(); //Словарь соответствия панелей 2D и 3D
|
||||
Transform[] layersPass;
|
||||
Transform[] layersPilot;
|
||||
Transform[] layersExternalPanels;
|
||||
Transform[] layerHeli;
|
||||
Transform[] otherPanels;
|
||||
public List<LayerMask> layersOrigHeli = new List<LayerMask>();
|
||||
public List<LayerMask> layersOrigPass = new List<LayerMask>();
|
||||
public List<LayerMask> layersOrigPilot = new List<LayerMask>();
|
||||
public List<LayerMask> layersOrigExternalPanels = new List<LayerMask>();
|
||||
public List<GameObject> layersOrigOtherPanels = new List<GameObject>();
|
||||
public List<GameObject> layersChangedOtherPanels = new List<GameObject>();
|
||||
public Camera cam;
|
||||
public GameObject prefabHint;
|
||||
// Глобальные переменные для хранения текущих углов поворотов ручек 0701,0702,0801,0802,0901-0902(Педали)
|
||||
[HideInInspector] public float cur070XangleVert; //Текущий угол наклона ручки 0701 и 0702 по вертикали
|
||||
[HideInInspector] public float cur080XangleVert; //Текущий угол наклона ручки 0801 и 0802 по вертикали
|
||||
[HideInInspector] public float cur080XangleHor; //Текущий угол наклона ручки 0801 и 0802 по горизонтали
|
||||
[HideInInspector] public float cur090XangleHor; //Текущий угол поворота педалей 0901 и 0902
|
||||
[HideInInspector] public string opened2Dpanel="";
|
||||
[HideInInspector] public MFIScript mfi1, mfi2, mfi3, mfi4, mfi5;
|
||||
// change skybox
|
||||
private Material sky, parking;
|
||||
public string skyboxmat = "park"; // sky,park - полет и земля; Варианты скайбокса для земли и воздуха
|
||||
|
||||
//[HideInInspector] public int memLeak = 0;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
//Debug.Log("Starting Manager.Awake.");
|
||||
player = GameObject.Find("Player").GetComponent<Player>();
|
||||
copter = GetRootObject("Copter");
|
||||
pilotcabin = GameObject.Find("Copter/Pilot_cabin");
|
||||
passcabin = GameObject.Find("Copter/Passanger_cabine");
|
||||
externalpanels = GameObject.Find("Copter/Fuzeliazh");
|
||||
//canvas = GameObject.Find("Canvas"); //В старом варианте
|
||||
canvas = GameObject.Find("CanvasPanel");//бутерброд не отключать
|
||||
cam = GameObject.Find("Camera").GetComponent<Camera>();//зедсь показывается бутерброд
|
||||
cabines2d = GameObject.Find("Cabines"); //здесть только основная камера для внутренних кабин и площадки перемещения внутри пассажирской кабины + eventSystems для канваса (не бутерброда)
|
||||
fusel = GameObject.Find("Obzor"); fusel.SetActive(false);
|
||||
//copterProz = GameObject.Find("CopterProz"); copterProz.SetActive(false);
|
||||
// ViewBackButton = GameObject.FindGameObjectWithTag("ViewBackButton");
|
||||
//ViewBackButton.SetActive(false);
|
||||
skv = GameObject.Find("Copter/SKV"); // Система СКВ,которая задублирована в FBX и которую нужно отключать в режиме кабина
|
||||
air = GameObject.Find("Air"); // Панель с видами вертолета
|
||||
menuPlayButtons = GameObject.Find("PlayButtons"); // панель плеера
|
||||
//allPanelsInCanvas = canvas.transform.GetChild(0);
|
||||
backBtn = GameObject.Find("backButton"); // Скрывать кнопку <<В кабину в режиме 3D
|
||||
//Camera.main.gameObject.AddComponent<forCamera>();
|
||||
cabinCamera.gameObject.AddComponent<forCamera>();
|
||||
backBtn.SetActive(false);
|
||||
is3D = true;
|
||||
// viewmode = 3; // По умолчанию мы находимся в обзорке
|
||||
|
||||
mfi1 = GameObject.Find("Panel0110").GetComponent<MFIScript>(); mfi1.LoadPrefab("mfi1");
|
||||
mfi2 = GameObject.Find("Panel0111").GetComponent<MFIScript>(); mfi2.LoadPrefab("mfi2");
|
||||
mfi3 = GameObject.Find("Panel0116").GetComponent<MFIScript>(); mfi3.LoadPrefab("mfi3");
|
||||
mfi4 = GameObject.Find("Panel0121").GetComponent<MFIScript>(); mfi4.LoadPrefab("mfi4");
|
||||
mfi5 = GameObject.Find("Panel0122").GetComponent<MFIScript>(); mfi5.LoadPrefab("mfi5");
|
||||
mfi1_cam = GameObject.Find("CameraMFI1").GetComponent<Camera>(); mfi2_cam = GameObject.Find("CameraMFI2").GetComponent<Camera>();
|
||||
mfi3_cam = GameObject.Find("CameraMFI3").GetComponent<Camera>(); mfi4_cam = GameObject.Find("CameraMFI4").GetComponent<Camera>();
|
||||
mfi5_cam = GameObject.Find("CameraMFI5").GetComponent<Camera>();
|
||||
mfi1_cam.enabled = false; mfi2_cam.enabled = false; mfi3_cam.enabled = false; mfi4_cam.enabled = false; mfi5_cam.enabled = false;
|
||||
|
||||
objects = new Mi38Objects();
|
||||
StartCoroutine(objects.Load());
|
||||
player.Init();
|
||||
|
||||
StartCoroutine(Init());
|
||||
//Try skybox
|
||||
sky = Resources.Load<Material>("Materials/MatSky");
|
||||
parking = Resources.Load<Material>("Materials/MatPark");
|
||||
//Change SkyBox
|
||||
if (skyboxmat == "sky") changeSkyBoxToSky();
|
||||
if (skyboxmat == "park") changeSkyBoxToPark();
|
||||
}
|
||||
IEnumerator Init()
|
||||
{
|
||||
//Debug.Log("Starting Manager.Init.");
|
||||
while (!objects.isLoaded)
|
||||
yield return null;
|
||||
//Debug.Log("Objects loaded.");
|
||||
/* Записываем оригинальные слои кабины пилотов,пассажирской кабины, и вертолета*/
|
||||
RecordOrigLayerHeli();
|
||||
RecordOrigLayerPilot();
|
||||
RecordOrigLayerPass();
|
||||
RecordOrigExternalPanels();
|
||||
|
||||
Transform[] allPanels = canvas.transform.GetChild(0).GetComponentsInChildren<Transform>();
|
||||
Transform[] allPanels3D = copter.GetComponentsInChildren<Transform>();
|
||||
|
||||
foreach (Transform _allPanels in allPanels)
|
||||
{
|
||||
if (_allPanels.name.StartsWith("Panel") && _allPanels.name.Length > 5)
|
||||
{
|
||||
foreach (Transform _allPanels3D in allPanels3D)
|
||||
{
|
||||
|
||||
if (_allPanels3D.name.StartsWith(_allPanels.name) && string.Compare(_allPanels3D.name.Substring(_allPanels3D.name.Length - 2), "3D") == 0 && _allPanels3D.name != null)
|
||||
{
|
||||
//Debug.Log("панели 3D" + _allPanels3D.name + " панели 2D " + _allPanels.name);
|
||||
allPanelsStatesList.Add(_allPanels3D.gameObject, _allPanels.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//foreach (KeyValuePair<GameObject, GameObject> kvp in allPanelsStatesList)
|
||||
// Debug.Log(kvp.Key.name + " " + kvp.Value.name);
|
||||
|
||||
GameObject[] activezones = GameObject.FindGameObjectsWithTag("activezone");
|
||||
foreach (GameObject _activezones in activezones)
|
||||
{
|
||||
_activezones.AddComponent<MakeActive>();
|
||||
_activezones.GetComponentInChildren<Collider>();
|
||||
// BoxCollider childcol = _activezones.GetComponentInChildren<BoxCollider>();
|
||||
// Debug.Log(_activezones.GetComponentInChildren<BoxCollider2D>() + " коллайдеры");
|
||||
//Debug.Log(_activezones.name + " объекты с activezone");
|
||||
//_activezones.GetComponentInChildren<BoxCollider>();
|
||||
//Debug.Log(_activezones.GetComponentInChildren<BoxCollider>() + " коллайдеры");
|
||||
}
|
||||
|
||||
StartCoroutine(ActivatePanels()); //yield return
|
||||
|
||||
//****************************
|
||||
|
||||
if (mode == "view")
|
||||
{
|
||||
fusel.SetActive(true);
|
||||
copter.SetActive(true);
|
||||
cabines2d.SetActive(false);
|
||||
cam.gameObject.SetActive(false); //canvas.SetActive(false);
|
||||
skv.SetActive(true); // Для Макса СКВ трубка
|
||||
menuPlayButtons.SetActive(true);
|
||||
// Закомментить
|
||||
//ChangeLayerPassCabineIgnore();
|
||||
//ChangeLayerPilotCabineIgnore();
|
||||
//ChangeLayerExternalPanelsDefault();
|
||||
DisablePassCabineCollider();
|
||||
DisablePilotCabineCollider();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mode == "free") menuPlayButtons.SetActive(false);
|
||||
copter.SetActive(true);
|
||||
cabines2d.SetActive(true);
|
||||
cam.gameObject.SetActive(false); //canvas.SetActive(false);
|
||||
fusel.SetActive(false);
|
||||
skv.SetActive(false);
|
||||
EnablePassCabineCollider();
|
||||
EnablePilotCabineCollider();
|
||||
}
|
||||
|
||||
if(menuCabinButton == null)
|
||||
{
|
||||
menuCabinButton = GameObject.Find("Air/view1").GetComponent<hintUI>();
|
||||
menuPassButton = GameObject.Find("Air/view2").GetComponent<hintUI>();
|
||||
menuViewButton = GameObject.Find("Air/view3").GetComponent<hintUI>();
|
||||
}
|
||||
|
||||
//SwitchTo3D();
|
||||
if (viewmode == 1)
|
||||
{
|
||||
EnablePassCabineCollider();
|
||||
EnablePilotCabineCollider();
|
||||
|
||||
ChangeLayerPilotCabineDefault();
|
||||
ChangeLayerExternalPanelsIgnore();
|
||||
ChangeLayerPassCabineIgnore();
|
||||
menuCabinButton.isGreen = true; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = false; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = false; menuViewButton.OnPointerUp(null);
|
||||
}
|
||||
else
|
||||
if (viewmode == 2)
|
||||
{
|
||||
EnablePassCabineCollider();
|
||||
EnablePilotCabineCollider();
|
||||
|
||||
ChangeLayerPilotCabineIgnore();
|
||||
ChangeLayerPassCabineDefault();
|
||||
ChangeLayerExternalPanelsIgnore();
|
||||
menuCabinButton.isGreen = false; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = true; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = false; menuViewButton.OnPointerUp(null);
|
||||
}
|
||||
else
|
||||
if (viewmode == 3)
|
||||
{
|
||||
DisablePassCabineCollider();
|
||||
DisablePilotCabineCollider();
|
||||
//ChangeLayerPilotCabineIgnore();
|
||||
//ChangeLayerPassCabineIgnore();
|
||||
ChangeLayerExternalPanelsDefault();
|
||||
menuCabinButton.isGreen = false; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = false; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = true; menuViewButton.OnPointerUp(null);
|
||||
}
|
||||
|
||||
isInitiated = true;
|
||||
//player.LoadScenario("System_2"); //debug
|
||||
//Debug.Log("Manager Initiated.");
|
||||
}
|
||||
|
||||
IEnumerator ActivatePanels()
|
||||
{
|
||||
//Debug.Log("Starting Manager.ActivatePanels.");
|
||||
GameObject[] panel2d = GameObject.FindGameObjectsWithTag("panels2d");
|
||||
foreach (GameObject _panel2d in panel2d)
|
||||
{
|
||||
_panel2d.AddComponent<Panel2D>();
|
||||
//Debug.LogError("Loading Panel2D: " + _panel2d.name);
|
||||
while (!_panel2d.GetComponent<Panel2D>().isStarted)
|
||||
yield return null;
|
||||
|
||||
_panel2d.GetComponent<Panel2D>().setDisabled();//отключаем панели кроме мфи
|
||||
//_panel2d.SetActive(false); // ! не далать так! отключается МФИ
|
||||
|
||||
panel2D.Add(_panel2d.name, _panel2d.GetComponent<Panel2D>());
|
||||
}
|
||||
|
||||
//if (mode != "scedit")
|
||||
objects.SetDefaultValues();
|
||||
|
||||
mfi1_cam.enabled = true; mfi2_cam.enabled = true; mfi3_cam.enabled = true; mfi4_cam.enabled = true; mfi5_cam.enabled = true;
|
||||
mfi1.SwitchScreen("ПИ_МАРШ"); mfi2.SwitchScreen("НИ_НАВ"); mfi3.SwitchScreen("НИ_ОВО"); mfi4.SwitchScreen("НИ_НАВ"); mfi5.SwitchScreen("ПИ_МАРШ");
|
||||
isPanelsActivated = true;
|
||||
//Debug.Log("Panels activated.");
|
||||
// System.GC.Collect();
|
||||
}
|
||||
|
||||
public void SwitchTo3D()
|
||||
{
|
||||
if (is3D) return;
|
||||
|
||||
foreach (Transform _allPanels in canvas.transform.GetChild(0).GetComponentsInChildren<Transform>())
|
||||
{
|
||||
_allPanels.gameObject.SetActive(true);
|
||||
}
|
||||
// Меняем слои,чтобы переключении в 2D блокировать элементы 3D кабины
|
||||
// viewmode 1-кабина пилотов, 2-пассажирская кабина, 3-режим свободного обзора (системы)
|
||||
is3D = true; opened2Dpanel = "";
|
||||
|
||||
if(!isProgressBarChangingInProgress)
|
||||
mouseExitUI();
|
||||
|
||||
//Camera.main.gameObject.AddComponent<forCamera>();
|
||||
cabinCamera.gameObject.AddComponent<forCamera>();
|
||||
if (viewmode == 2) //Camera.main.GetComponent<forCamera>().limitVert = 179.99f; // Если мы в кабине пассажирской,то угол вращения увеличиваем
|
||||
cabinCamera.GetComponent<forCamera>().limitVert = 179.99f; //Camera.main.transform.localEulerAngles = new Vector3(0, 0, 0); //Возврат камеры в исходное
|
||||
cam.gameObject.SetActive(false); //canvas.SetActive(false);
|
||||
foreach (Panel2D p in panel2D.Values)//отключаем панели кроме мфи
|
||||
{
|
||||
p.GetComponent<Panel2D>().setDisabled();
|
||||
//if (String.Compare(p.name, "Panel0110") == 0) p.GetComponent<Panel2D>().setEnabled();
|
||||
}
|
||||
|
||||
copter.SetActive(true);
|
||||
backBtn.SetActive(false);
|
||||
skv.SetActive(false);
|
||||
//air.SetActive(true);
|
||||
}
|
||||
public void SwitchTo2D(string _panels2d)
|
||||
{
|
||||
if (!panel2D.ContainsKey(_panels2d))
|
||||
return;
|
||||
cam.gameObject.SetActive(true);// canvas.SetActive(true);
|
||||
copter.SetActive(true);
|
||||
backBtn.SetActive(true);
|
||||
//air.SetActive(false);
|
||||
//Component.Destroy(Camera.main.gameObject.GetComponent<forCamera>());
|
||||
Component.Destroy(cabinCamera.gameObject.GetComponent<forCamera>());
|
||||
// Блокируем в 2D все 3D панели
|
||||
//ChangeLayerIgnore();
|
||||
mouseEnterUI();
|
||||
|
||||
//Включаем Канвас и выключаем все 2D панели внутри Canvas -> Panel
|
||||
foreach (string panelName in panel2D.Keys)
|
||||
{
|
||||
panel2D[panelName].setDisabled();
|
||||
}
|
||||
if (panel2D[_panels2d] != null)
|
||||
{
|
||||
is3D = false;
|
||||
panel2D[_panels2d].setEnabled();
|
||||
|
||||
opened2Dpanel = _panels2d;
|
||||
UnityObject switchTo2DPanelObject = objects.Find(_panels2d);
|
||||
if (switchTo2DPanelObject != null)
|
||||
StartCoroutine(SwitchTo2DSetCurrentStates(switchTo2DPanelObject));
|
||||
|
||||
/*if (_panels2d == "Panel0701")
|
||||
panel2D[_panels2d].transform.Find("Button0701").gameObject.GetComponent<ButtonCubik>().SetView();
|
||||
if (_panels2d == "Panel0702")
|
||||
panel2D[_panels2d].transform.Find("Button0702").gameObject.GetComponent<ButtonCubik>().SetView();
|
||||
if (_panels2d == "Panel0801")
|
||||
panel2D[_panels2d].transform.Find("Button0801").gameObject.GetComponent<ButtonCubik>().SetView();
|
||||
if (_panels2d == "Panel0802")
|
||||
panel2D[_panels2d].transform.Find("Button0802").gameObject.GetComponent<ButtonCubik>().SetView(); */
|
||||
if (mode == "play")
|
||||
backBtn.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//panel2D[_panels2d].setDisabled();
|
||||
//SwitchTo3D();
|
||||
}
|
||||
}
|
||||
IEnumerator SwitchTo2DSetCurrentStates(UnityObject switchTo2DPanelObject)
|
||||
{
|
||||
while (!switchTo2DPanelObject.gameObject.GetComponent<Panel2D>().isStarted)
|
||||
yield return null;
|
||||
//Debug.Log("Panel " + switchTo2DPanelObject.name + " isStarted " + switchTo2DPanelObject.gameObject.GetComponent<Panel2D>().isStarted);
|
||||
if (switchTo2DPanelObject.name == "Panel0901") objects.Find("Rampa0901").SetObjectState((int)cur090XangleHor);
|
||||
if (switchTo2DPanelObject.name == "Panel0902") objects.Find("Rampa0902").SetObjectState((int)cur090XangleHor);
|
||||
if (switchTo2DPanelObject.name == "Panel0801") objects.Find("view3_0801").SetObjectState((int)cur080XangleHor); //.curState =
|
||||
if (switchTo2DPanelObject.name == "Panel0802") objects.Find("view3_0802").SetObjectState((int)cur080XangleHor);
|
||||
if (switchTo2DPanelObject.name == "Panel0801") objects.Find("view2_0801").SetObjectState((int)cur080XangleVert);
|
||||
if (switchTo2DPanelObject.name == "Panel0802") objects.Find("view2_0802").SetObjectState((int)cur080XangleVert);
|
||||
if (switchTo2DPanelObject.name == "Panel0701") objects.Find("Handle3_0701").SetObjectState((int)cur070XangleVert);
|
||||
if (switchTo2DPanelObject.name == "Panel0702") objects.Find("Handle3_0702").SetObjectState((int)cur070XangleVert);
|
||||
|
||||
objects.SetCurrentValues(switchTo2DPanelObject);
|
||||
}
|
||||
|
||||
public void RecordOrigLayerHeli()
|
||||
{
|
||||
layersOrigHeli.Clear();
|
||||
layerHeli = copter.transform.GetComponentsInChildren<Transform>();
|
||||
foreach (Transform _layerHeli in layerHeli)
|
||||
{
|
||||
layersOrigHeli.Add(_layerHeli.gameObject.layer);
|
||||
}
|
||||
}
|
||||
public void RecordOrigLayerPass()
|
||||
{
|
||||
layersOrigPass.Clear();
|
||||
layersPass = passcabin.transform.GetComponentsInChildren<Transform>();
|
||||
foreach (Transform _layersPass in layersPass)
|
||||
{
|
||||
//Debug.Log(_layerHeli.gameObject.layer + " layer");
|
||||
layersOrigPass.Add(_layersPass.gameObject.layer);
|
||||
}
|
||||
}
|
||||
public void RecordOrigLayerPilot()
|
||||
{
|
||||
layersOrigPilot.Clear();
|
||||
layersOrigOtherPanels.Clear();
|
||||
layersChangedOtherPanels.Clear();
|
||||
layersPilot = pilotcabin.transform.GetComponentsInChildren<Transform>();
|
||||
foreach (Transform _layersPilot in layersPilot)
|
||||
{
|
||||
layersOrigPilot.Add(_layersPilot.gameObject.layer);
|
||||
}
|
||||
/* Добавляем те панели, которые не попали в panelcabin,passcabin*/
|
||||
// layersOrigOtherPanels - список с оригинальными слоями остальных панелей
|
||||
// layersChangedOtherPanels - список в котором мы переводим объекты в Ignore
|
||||
/*
|
||||
layersOrigOtherPanels.Add(GameObject.Find("Copter/ROSH_UprDvigateliamy/Dummy005/Panel0701_3D").gameObject.layer);
|
||||
layersOrigOtherPanels.Add(GameObject.Find("Copter/ROSH_UprDvigateliamy/Dummy004/Panel0702_3D").gameObject.layer);
|
||||
layersOrigOtherPanels.Add(GameObject.Find("Panel0801_3D").gameObject.layer);
|
||||
layersOrigOtherPanels.Add(GameObject.Find("Panel0802_3D").gameObject.layer);
|
||||
layersOrigOtherPanels.Add(GameObject.Find("Copter/Putevoe_upravlenie/Panel0901_3D").gameObject.layer);
|
||||
layersOrigOtherPanels.Add(GameObject.Find("Copter/Putevoe_upravlenie/Panel0902_3D").gameObject.layer);
|
||||
layersOrigOtherPanels.Add(GameObject.Find("Copter/Panel1001_3D").gameObject.layer);
|
||||
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/ROSH_UprDvigateliamy/Dummy005/Panel0701_3D").gameObject.layer);
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/ROSH_UprDvigateliamy/Dummy004/Panel0702_3D").gameObject.layer);
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Panel0801_3D").gameObject.layer);
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Panel0802_3D").gameObject.layer);
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/Putevoe_upravlenie/Panel0901_3D").gameObject.layer);
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/Putevoe_upravlenie/Panel0902_3D").gameObject.layer);
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/Panel1001_3D").gameObject.layer);
|
||||
*/
|
||||
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/ROSH_UprDvigateliamy/Dummy005/Panel0701_3D"));
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/ROSH_UprDvigateliamy/Dummy004/Panel0702_3D"));
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Panel0801_3D"));
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Panel0802_3D"));
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/Putevoe_upravlenie/Panel0901_3D"));
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/Putevoe_upravlenie/Panel0902_3D"));
|
||||
layersChangedOtherPanels.Add(GameObject.Find("Copter/Panel1001_3D"));
|
||||
}
|
||||
|
||||
public void RecordOrigExternalPanels() // Записываем слои внешних панелей
|
||||
{
|
||||
layersOrigExternalPanels.Clear();
|
||||
layersExternalPanels = externalpanels.transform.GetComponentsInChildren<Transform>();
|
||||
foreach (Transform _layersExternalPanels in layersExternalPanels)
|
||||
{
|
||||
layersOrigExternalPanels.Add(_layersExternalPanels.gameObject.layer);
|
||||
}
|
||||
}
|
||||
|
||||
/* public void ChangeLayerIgnore()
|
||||
{
|
||||
foreach (Transform _allPanels in copter.transform.GetComponentsInChildren<Transform>())
|
||||
{
|
||||
_allPanels.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
|
||||
}
|
||||
}*/
|
||||
|
||||
public void ChangeLayerDefault()
|
||||
{
|
||||
for (int i = 0; i < layersOrigHeli.Count; i++)
|
||||
{
|
||||
layerHeli[i].gameObject.layer = layersOrigHeli[i];
|
||||
}
|
||||
}
|
||||
// Кабина пилотов слои и коллайдеры
|
||||
public void ChangeLayerPilotCabineIgnore()
|
||||
{
|
||||
/* foreach (Transform _allPanelsPilot in pilotcabin.transform.GetComponentsInChildren<Transform>())
|
||||
{
|
||||
_allPanelsPilot.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
|
||||
}*/
|
||||
// Остальные панели(те которые находятся в других системах) переводим в Ignore
|
||||
for (int i = 0; i < layersChangedOtherPanels.Count; i++)
|
||||
{
|
||||
// layersChangedOtherPanels[i] = LayerMask.NameToLayer("Ignore Raycast");
|
||||
layersChangedOtherPanels[i].GetComponentInChildren<Collider>().enabled = false;
|
||||
}
|
||||
foreach (Collider _allPanelsPilot in pilotcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
_allPanelsPilot.GetComponent<Collider>().enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
public void ChangeLayerPilotCabineDefault()
|
||||
{
|
||||
/* for (int i = 0; i < layersOrigPilot.Count; i++)
|
||||
{
|
||||
layersPilot[i].gameObject.layer = layersOrigPilot[i];
|
||||
}*/
|
||||
// Возвращаем оставшиеся панели обратно в родные слои // upd Коллайдеры включаем
|
||||
//for (int y = 0; y < layersChangedOtherPanels.Count; y++)
|
||||
for (int i = 0; i < layersChangedOtherPanels.Count; i++)
|
||||
{
|
||||
layersChangedOtherPanels[i].GetComponentInChildren<Collider>().enabled = true;
|
||||
}
|
||||
foreach (Collider _allPanelsPilot in pilotcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
_allPanelsPilot.GetComponent<Collider>().enabled = true;
|
||||
}
|
||||
}
|
||||
public void DisablePilotCabineCollider()
|
||||
{
|
||||
foreach (Collider _allPanelsPilot in pilotcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
//_allPanelsPilot.collider.enabled = false;
|
||||
_allPanelsPilot.GetComponent<Collider>().enabled = false;
|
||||
}
|
||||
}
|
||||
public void EnablePilotCabineCollider()
|
||||
{
|
||||
foreach (Collider _allPanelsPilot in pilotcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
//_allPanelsPilot.collider.enabled = false;
|
||||
_allPanelsPilot.GetComponent<Collider>().enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Пассажирская кабина слои и коллайдеры
|
||||
public void ChangeLayerPassCabineIgnore()
|
||||
{
|
||||
/* foreach (Transform _allPanelsPilot in passcabin.transform.GetComponentsInChildren<Transform>())
|
||||
{
|
||||
_allPanelsPilot.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
|
||||
}*/
|
||||
foreach (Collider _allPanelsPass in passcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
_allPanelsPass.GetComponent<Collider>().enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
public void ChangeLayerPassCabineDefault()
|
||||
{
|
||||
/* for (int i = 0; i < layersOrigPass.Count; i++)
|
||||
{
|
||||
layersPass[i].gameObject.layer = layersOrigPass[i];
|
||||
}*/
|
||||
foreach (Collider _allPanelsPass in passcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
_allPanelsPass.GetComponent<Collider>().enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void DisablePassCabineCollider()
|
||||
{
|
||||
foreach (Collider _allCollidersPass in passcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
//Debug.Log(_allPanelsPilot);
|
||||
//_allPanelsPilot.collider.enabled = false;
|
||||
_allCollidersPass.GetComponent<Collider>().enabled = false;
|
||||
}
|
||||
}
|
||||
public void EnablePassCabineCollider()
|
||||
{
|
||||
foreach (Collider _allCollidersPass in passcabin.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
//Debug.Log(_allPanelsPilot);
|
||||
//_allPanelsPilot.collider.enabled = false;
|
||||
_allCollidersPass.GetComponent<Collider>().enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Внешние системы слои
|
||||
public void ChangeLayerExternalPanelsIgnore()
|
||||
{
|
||||
/* foreach (Transform _allPanelsExt in externalpanels.transform.GetComponentsInChildren<Transform>())
|
||||
{
|
||||
_allPanelsExt.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
|
||||
*//* if(_allPanelsExt.GetComponentInChildren<Collider>() != null) // Для режима scedit raycast все равно пробивает объекты "ignore raycast"
|
||||
_allPanelsExt.GetComponentInChildren<Collider>().enabled = false;*//*
|
||||
}*/
|
||||
foreach (Collider _allPanelsExt in externalpanels.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
//Debug.Log(_allPanelsPilot);
|
||||
//_allPanelsPilot.collider.enabled = false;
|
||||
_allPanelsExt.GetComponent<Collider>().enabled = false;
|
||||
}
|
||||
}
|
||||
public void ChangeLayerExternalPanelsDefault()
|
||||
{
|
||||
/* for (int i = 0; i < layersOrigExternalPanels.Count; i++)
|
||||
{
|
||||
layersExternalPanels[i].gameObject.layer = layersOrigExternalPanels[i];
|
||||
*//* if (layersExternalPanels[i].GetComponentInChildren<Collider>() != null)
|
||||
layersExternalPanels[i].GetComponentInChildren<Collider>().enabled = true;*//*
|
||||
}*/
|
||||
foreach (Collider _allPanelsExt in externalpanels.transform.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
//Debug.Log(_allPanelsPilot);
|
||||
//_allPanelsPilot.collider.enabled = false;
|
||||
_allPanelsExt.GetComponent<Collider>().enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseEnterUI()
|
||||
{
|
||||
//Debug.Log("зашли на UI");
|
||||
isMouseOverUI = true;
|
||||
ChangeLayerPassCabineIgnore();
|
||||
ChangeLayerPilotCabineIgnore();
|
||||
ChangeLayerExternalPanelsIgnore();
|
||||
}
|
||||
public void mouseExitUI()
|
||||
{
|
||||
if (!is3D || !isInitiated || isProgressBarChangingInProgress) return; //
|
||||
if (mode == "play" && player.playMode != "waitForClick") return; // если в глобальном режиме play, то подсвечиваем объекты только при waitForClick
|
||||
//Debug.Log("вышли из UI");
|
||||
// ChangeLayerDefault();
|
||||
|
||||
isMouseOverUI = false;
|
||||
if (viewmode == 1)
|
||||
{
|
||||
//EnablePassCabineCollider();
|
||||
EnablePilotCabineCollider();
|
||||
|
||||
ChangeLayerPilotCabineDefault();
|
||||
ChangeLayerExternalPanelsIgnore();
|
||||
ChangeLayerPassCabineIgnore();
|
||||
menuCabinButton.isGreen = true; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = false; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = false; menuViewButton.OnPointerUp(null);
|
||||
}
|
||||
else
|
||||
if (viewmode == 2)
|
||||
{
|
||||
EnablePassCabineCollider();
|
||||
//EnablePilotCabineCollider();
|
||||
|
||||
ChangeLayerPilotCabineIgnore();
|
||||
ChangeLayerPassCabineDefault();
|
||||
ChangeLayerExternalPanelsIgnore();
|
||||
menuCabinButton.isGreen = false; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = true; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = false; menuViewButton.OnPointerUp(null);
|
||||
}
|
||||
else
|
||||
if (viewmode == 3)
|
||||
{
|
||||
DisablePassCabineCollider();
|
||||
DisablePilotCabineCollider();
|
||||
//ChangeLayerPilotCabineIgnore();
|
||||
//ChangeLayerPassCabineIgnore();
|
||||
ChangeLayerExternalPanelsDefault();
|
||||
menuCabinButton.isGreen = false; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = false; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = true; menuViewButton.OnPointerUp(null);
|
||||
}
|
||||
}
|
||||
|
||||
static GameObject GetRootObject(string objName)
|
||||
{
|
||||
UnityEngine.SceneManagement.Scene activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
|
||||
GameObject[] rootObjects = activeScene.GetRootGameObjects();
|
||||
|
||||
// GameObject res = new GameObject();
|
||||
|
||||
for (int i = 0; i < rootObjects.Length; i++)
|
||||
{
|
||||
//Debug.Log(rootObjects[i].name);
|
||||
if (string.Compare(rootObjects[i].name, objName) == 0)
|
||||
{
|
||||
|
||||
return (rootObjects[i]);
|
||||
}
|
||||
}
|
||||
return (null);
|
||||
}
|
||||
public void switchModeView() // внешний вид
|
||||
{
|
||||
//mode = "view";
|
||||
viewmode = 3;
|
||||
fusel.SetActive(true);
|
||||
copter.SetActive(true);
|
||||
cabines2d.SetActive(false);
|
||||
cam.gameObject.SetActive(false); //canvas.SetActive(false);
|
||||
skv.SetActive(true); // Для Макса СКВ трубка
|
||||
//menuPlayButtons.SetActive(true);
|
||||
|
||||
// Закомментить
|
||||
//ChangeLayerPassCabineIgnore();
|
||||
//ChangeLayerPilotCabineIgnore();
|
||||
//ChangeLayerExternalPanelsDefault();
|
||||
DisablePassCabineCollider();
|
||||
DisablePilotCabineCollider();
|
||||
ChangeLayerExternalPanelsDefault();
|
||||
|
||||
ViewBackButton.GetComponent<Button>().onClick.Invoke();
|
||||
fusel.GetComponent<ChangeSystem>().SwitchOffAllCams();
|
||||
//GameObject.Find("ButtonMainBack").SetActive(false); GameObject.Find("ButtonMainBackTMP").SetActive(false);
|
||||
|
||||
if (menuCabinButton == null)
|
||||
{
|
||||
menuCabinButton = GameObject.Find("Air/view1").GetComponent<hintUI>();
|
||||
menuPassButton = GameObject.Find("Air/view2").GetComponent<hintUI>();
|
||||
menuViewButton = GameObject.Find("Air/view3").GetComponent<hintUI>();
|
||||
}
|
||||
menuCabinButton.isGreen = false; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = false; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = true; menuViewButton.OnPointerUp(null);
|
||||
|
||||
|
||||
}
|
||||
public void switchModeFree() // внутри: кабина или грузовой
|
||||
{
|
||||
if (mode == "free") menuPlayButtons.SetActive(false);
|
||||
copter.SetActive(true);
|
||||
cabines2d.SetActive(true);
|
||||
cam.gameObject.SetActive(false); //canvas.SetActive(false);
|
||||
fusel.SetActive(false);
|
||||
skv.SetActive(false);
|
||||
copterProz.SetActive(false);// Отключать прозрачный вертолет при выходе из обзорки
|
||||
EnablePassCabineCollider();
|
||||
EnablePilotCabineCollider();
|
||||
ChangeLayerExternalPanelsIgnore();
|
||||
menuCabinButton.isGreen = true; menuCabinButton.OnPointerUp(null);
|
||||
menuPassButton.isGreen = false; menuPassButton.OnPointerUp(null);
|
||||
menuViewButton.isGreen = false; menuViewButton.OnPointerUp(null);
|
||||
}
|
||||
|
||||
public void changeSkyBoxToSky()
|
||||
{
|
||||
RenderSettings.skybox = sky;
|
||||
}
|
||||
public void changeSkyBoxToPark()
|
||||
{
|
||||
RenderSettings.skybox = parking;
|
||||
}
|
||||
private bool IsMouseOverUI()
|
||||
{
|
||||
return EventSystem.current.IsPointerOverGameObject();
|
||||
}
|
||||
// && !IsMouseOverUI()
|
||||
//&& !EventSystem.current.IsPointerOverGameObject()
|
||||
|
||||
|
||||
|
||||
/* **** Подсветка Selectable панелей **** */
|
||||
//private void Update()
|
||||
//{
|
||||
|
||||
/* Debug.Log("bool IsMouseOverUI " + IsMouseOverUI());
|
||||
if (_selection != null )
|
||||
{
|
||||
var selectionRenderer = _selection.GetComponent<Renderer>();
|
||||
selectionRenderer.material = defaultMaterial;
|
||||
_selection = null;
|
||||
|
||||
}
|
||||
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit) && !IsMouseOverUI() )
|
||||
{
|
||||
//Debug.Log("bool IsMouseOverUI " + IsMouseOverUI());
|
||||
var selection = hit.transform;
|
||||
if (selection.CompareTag(selectableTag) )
|
||||
{
|
||||
var selectionRenderer = selection.GetComponent<Renderer>();
|
||||
var defaultRender = selectionRenderer;
|
||||
if (selectionRenderer != null)
|
||||
{
|
||||
defaultMaterial = selectionRenderer.material;
|
||||
//Debug.Log(defaultMaterial);
|
||||
selectionRenderer.material = highlightMaterial;
|
||||
}
|
||||
_selection = selection;
|
||||
}
|
||||
}*/
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -94,100 +93,3 @@ public class drCol112 : MonoBehaviour
|
||||
}
|
||||
|
||||
}
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class drCol112 : MonoBehaviour
|
||||
{
|
||||
protected Vector3 mousePosition;
|
||||
protected Vector2 a; // Vector2 deltaPosition
|
||||
public string typeDrag = null;
|
||||
public float dragMin, dragMax;
|
||||
public bool clamp = false;
|
||||
|
||||
[HideInInspector] public Vector2 dd;//для передачи в connection
|
||||
[HideInInspector] public bool _delta = false;//для передачи в connection
|
||||
|
||||
[HideInInspector] public bool isDrag = false;
|
||||
Manager man;
|
||||
|
||||
Camera cam;//камера для канваса с панелями
|
||||
private void Awake()
|
||||
{
|
||||
dd = new Vector2(transform.localPosition.x, transform.localPosition.y);
|
||||
if (man == null) man = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
cam = man.cam;
|
||||
}
|
||||
public void OnMouseDown()
|
||||
{
|
||||
calculationBegin();
|
||||
}
|
||||
public void OnMouseDrag()
|
||||
{
|
||||
calculationDrag();
|
||||
|
||||
}
|
||||
|
||||
public void OnMouseUp()
|
||||
{
|
||||
dd = new Vector2(transform.localPosition.x, transform.localPosition.y);
|
||||
if (typeDrag == "x" && (dd.x == dragMin || dd.x == dragMax))
|
||||
{
|
||||
_delta = true;
|
||||
}
|
||||
else if (typeDrag == "y" && (dd.y == dragMin || dd.y == dragMax))
|
||||
{
|
||||
_delta = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_delta = false;
|
||||
}
|
||||
isDrag = false;
|
||||
}
|
||||
public void calculationBegin()
|
||||
{
|
||||
//a = new Vector2(Input.mousePosition.x - transform.localPosition.x, Input.mousePosition.y - transform.localPosition.y);
|
||||
mousePosition = cam.ScreenToWorldPoint(Input.mousePosition);//mousePosition = Input.mousePosition;
|
||||
a = new Vector2(mousePosition.x - transform.localPosition.x, mousePosition.y - transform.localPosition.y);
|
||||
isDrag = true;
|
||||
}
|
||||
public void calculationDrag()
|
||||
{
|
||||
if (man.mode == "scedit" || man.mode == "play")
|
||||
return;
|
||||
mousePosition = cam.ScreenToWorldPoint(Input.mousePosition);//mousePosition = Input.mousePosition;
|
||||
Vector2 q = new Vector2(mousePosition.x, mousePosition.y);
|
||||
Vector3 b = new Vector3(q.x - a.x, q.y - a.y, transform.localPosition.z);
|
||||
|
||||
if (typeDrag == "x")
|
||||
{
|
||||
b.x = (clamp) ? Mathf.Clamp(b.x, dragMin, dragMax) : b.x;
|
||||
transform.localPosition = new Vector3(b.x, transform.localPosition.y, transform.localPosition.z);
|
||||
}
|
||||
else
|
||||
if (typeDrag == "y")
|
||||
{
|
||||
b.y = (clamp) ? Mathf.Clamp(b.y, dragMin, dragMax) : b.y;
|
||||
transform.localPosition = new Vector3(transform.localPosition.x, b.y, transform.localPosition.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.localPosition = b;
|
||||
}
|
||||
}
|
||||
public void SetState(int b)
|
||||
{
|
||||
float bf = (clamp) ? Mathf.Clamp((float)b/100f, dragMin, dragMax) : b/100;
|
||||
//b += (int)(dragMax - dragMin) / 2;
|
||||
if (typeDrag == "x")
|
||||
transform.localPosition = new Vector3(bf, transform.localPosition.y, transform.localPosition.z);
|
||||
else
|
||||
if (typeDrag == "y")
|
||||
transform.localPosition = new Vector3(transform.localPosition.x, bf, transform.localPosition.z);
|
||||
}
|
||||
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -80,86 +79,3 @@ public class ButtonCheckable : MonoBehaviour
|
||||
OnCheck();
|
||||
}
|
||||
}
|
||||
=======
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ButtonCheckable : MonoBehaviour
|
||||
{
|
||||
Dictionary<string, GameObject> buttonStatesList = new Dictionary<string, GameObject>();
|
||||
|
||||
// int posCount;
|
||||
// int currentPos;
|
||||
GameObject goUp;
|
||||
GameObject goDown;
|
||||
public bool isChecked = false;
|
||||
public bool isStarted = false;
|
||||
Image goUp_Img=null, goDown_Img=null;
|
||||
SpriteRenderer goUp_SR = null, goDown_SR = null;
|
||||
Manager man;
|
||||
|
||||
void Start()
|
||||
{
|
||||
man = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
// Debug.Log(go.name);
|
||||
Transform[] buttonStates = this.GetComponentsInChildren<Transform>();
|
||||
// Debug.Log(btnList.Length);
|
||||
// goUp = new GameObject();
|
||||
// goDown = new GameObject();
|
||||
for (int i = 0; i < buttonStates.Length; i++)
|
||||
{
|
||||
if (i == 0) continue;
|
||||
if (string.Compare(buttonStates[i].name.Substring(buttonStates[i].name.Length - 2), "up") == 0) // this.name.Length - 3
|
||||
goUp = buttonStates[i].gameObject;
|
||||
if (string.Compare(buttonStates[i].name.Substring(buttonStates[i].name.Length - 4), "down") == 0) // this.name.Length - 3
|
||||
goDown = buttonStates[i].gameObject;
|
||||
}
|
||||
goUp_Img = goUp.GetComponent<Image>();
|
||||
goUp_SR = goUp.GetComponent<SpriteRenderer>();
|
||||
goDown_Img = goDown.GetComponent<Image>();
|
||||
goDown_SR = goDown.GetComponent<SpriteRenderer>();
|
||||
|
||||
if (goUp_Img != null) goUp_Img.enabled = !isChecked;
|
||||
if (goUp_SR != null) goUp_SR.enabled = !isChecked;
|
||||
if (goDown_Img != null) goDown_Img.enabled = isChecked;
|
||||
if (goDown_SR != null) goDown_SR.enabled = isChecked;
|
||||
isStarted = true;
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
if (man.mode == "scedit" || man.mode == "play")
|
||||
return;
|
||||
OnCheck();
|
||||
}
|
||||
|
||||
|
||||
public void OnCheck()
|
||||
{
|
||||
if (goUp == null || goDown == null) Start();
|
||||
if (goUp == null || goDown == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
isChecked = !isChecked;
|
||||
if (goUp_Img != null) goUp_Img.enabled = !isChecked;
|
||||
if (goUp_SR != null) goUp_SR.enabled = !isChecked;
|
||||
if (goDown_Img != null) goDown_Img.enabled = isChecked;
|
||||
if (goDown_SR != null) goDown_SR.enabled = isChecked;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SetState(int st)
|
||||
{
|
||||
if (st == 0) isChecked = true; else isChecked = false;
|
||||
OnCheck();
|
||||
}
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -46,52 +45,3 @@ public class Switch : MonoBehaviour
|
||||
switcheStatesList[swName].switchOn();
|
||||
}
|
||||
}
|
||||
=======
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Switch : MonoBehaviour
|
||||
{
|
||||
List<string> switcheStatesListNames = new List<string>();
|
||||
//Dictionary<string, GameObject> switcheStatesList = new Dictionary<string, GameObject>();
|
||||
public Dictionary<string, SwitchState> switcheStatesList = new Dictionary<string, SwitchState>();
|
||||
bool isStarted = false;
|
||||
|
||||
// int posCount;
|
||||
// int currentPos;
|
||||
void Start()
|
||||
{
|
||||
if (isStarted) return;
|
||||
// Debug.Log(go.name);
|
||||
Transform[] switchStates = this.GetComponentsInChildren<Transform>();
|
||||
// Debug.Log(btnList.Length);
|
||||
for (int i = 0; i < switchStates.Length; i++)
|
||||
{
|
||||
if (i == 0) continue;
|
||||
// Debug.Log(btnList[i].gameObject.name);
|
||||
switchStates[i].gameObject.AddComponent<SwitchState>();
|
||||
switcheStatesListNames.Add(switchStates[i].gameObject.name);
|
||||
switcheStatesList.Add(switchStates[i].gameObject.name, switchStates[i].gameObject.GetComponent<SwitchState>());
|
||||
}
|
||||
switcheStatesListNames.Sort();
|
||||
if(switcheStatesListNames.Count>0)
|
||||
switcheStatesList[switcheStatesListNames[0]].switchOn();
|
||||
isStarted = true;
|
||||
//setState(1);
|
||||
}
|
||||
|
||||
public void setState(int state)
|
||||
{
|
||||
if (!isStarted) Start();
|
||||
if (state >= 0 && state < switcheStatesListNames.Count)
|
||||
switcheStatesList[switcheStatesListNames[state]].switchOn();
|
||||
else
|
||||
Debug.LogError("Ошибка установки состояния " + state + " объекта " + this.gameObject.name);
|
||||
}
|
||||
public void setState(string swName)
|
||||
{
|
||||
if (!isStarted) Start();
|
||||
switcheStatesList[swName].switchOn();
|
||||
}
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -255,261 +254,3 @@ public class MakeActive : MonoBehaviour //, IPointerEnterHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public class MakeActive : MonoBehaviour //, IPointerEnterHandler
|
||||
{
|
||||
// public Color _defaultRender;
|
||||
|
||||
Material activeMaterial;
|
||||
|
||||
|
||||
public Dictionary<string, GameObject> switchesList3D = new Dictionary<string, GameObject>(); // Обычные переключатели 3D
|
||||
public Dictionary<string, GameObject> switchesList3Dh = new Dictionary<string, GameObject>(); // Переключатели 3D горизонтальные
|
||||
|
||||
public List<Material> materials = new List<Material>();
|
||||
public List<Material> greenMaterials = new List<Material>();
|
||||
public Renderer[] renderers;
|
||||
public bool materialsReplaced = false;
|
||||
Manager man;
|
||||
public Material door_03_rend;
|
||||
public Material door_03_mat;
|
||||
//**** для подсказок
|
||||
private GameObject hint3D;
|
||||
public GameObject go;
|
||||
private string t;
|
||||
private GameObject canvasM;
|
||||
//****
|
||||
|
||||
//void Start() // Вернуть потом назад
|
||||
public void Start()
|
||||
{
|
||||
activeMaterial = Resources.Load<Material>("materials/Зелен");
|
||||
man = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
|
||||
//Debug.Log(activeMaterial);
|
||||
renderers = this.transform.parent.GetComponentsInChildren<Renderer>();
|
||||
|
||||
RecordChildrenMaterials();
|
||||
|
||||
FindAndAddCoverVertical(); //Ищем крышки которые поворачиваются вертикально по тегу и вешаем скрипт поворота
|
||||
FindAndAddCoverHorizontal(); //Ищем крышки которые поворачиваются горизонтально по тегу и вешаем скрипт поворота
|
||||
FindAndAddSwitchVertikal(); //Ищем переключатели, вешаем скрипт поворота Switch3DRotate.cs
|
||||
FindAndAddSwitchHorizontal();
|
||||
|
||||
canvasM = GameObject.Find("CanvasMenu");
|
||||
go = man.prefabHint;
|
||||
t = "";
|
||||
foreach (KeyValuePair<string, string> p in panelName.allPanelsList)
|
||||
{
|
||||
if (String.Compare(p.Key, this.transform.parent.name) == 0)
|
||||
{
|
||||
t = panelName.allPanelsList[this.transform.parent.name];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//private void OnMouseEnter()
|
||||
public void OnMouseEnter()
|
||||
{
|
||||
/* foreach (Transform child in this.transform.parent) //получить всех детей
|
||||
{
|
||||
|
||||
//_defaultRender = child.GetComponent<Renderer>().material.color;
|
||||
// child.GetComponent<Renderer>().material.color = Color.green;
|
||||
}*/
|
||||
ReplaceMaterialsWithActive();
|
||||
//if (man.mode == "scedit" || man.mode == "play") return;
|
||||
if (hint.IsHint && t != "")
|
||||
{
|
||||
|
||||
hint3D = OnHint(this.gameObject, go, t);
|
||||
}
|
||||
}
|
||||
public GameObject OnHint(GameObject btn, GameObject objGo, string t)
|
||||
{
|
||||
Vector3 mousePos = Input.mousePosition;
|
||||
Vector2 hintPos = new Vector2(mousePos.x, mousePos.y);
|
||||
GameObject hintObj = Instantiate(objGo, canvasM.transform);
|
||||
hintObj.transform.position = hintPos;
|
||||
Text txt = hintObj.GetComponentInChildren<Text>();
|
||||
txt.text = t;
|
||||
|
||||
var hintBase = hintObj.GetComponentInChildren<Image>();
|
||||
var s = txt.text.Length;
|
||||
var upper = 0;
|
||||
foreach (char letter in t.Where(char.IsUpper))
|
||||
upper++;
|
||||
var sizeX = (s- upper) * 11.2f+(upper*15.5f);
|
||||
if ((sizeX + hintBase.transform.position.x) > 1920)
|
||||
{
|
||||
float pos = hintObj.transform.localPosition.x - sizeX;
|
||||
if (pos < 0) pos = -30;
|
||||
hintObj.transform.localPosition = new Vector2(pos, hintObj.transform.localPosition.y);
|
||||
}
|
||||
|
||||
return hintObj;
|
||||
}
|
||||
//private void OnMouseExit()
|
||||
public void OnMouseExit()
|
||||
{
|
||||
if (!hlight.l)
|
||||
{
|
||||
RestoreChildrenMaterials();
|
||||
}
|
||||
Destroy(hint3D);
|
||||
}
|
||||
|
||||
private void RecordChildrenMaterials()
|
||||
{
|
||||
materials.Clear(); greenMaterials.Clear();
|
||||
|
||||
foreach (var renderer in renderers)
|
||||
{
|
||||
materials.Add(renderer.material);
|
||||
if (this.name == "door_03")
|
||||
{
|
||||
Material[] door_03_rend = GameObject.Find("Copter/Fuzeliazh/Door_03/door_03").GetComponent<Renderer>().materials;
|
||||
Material greenMat = new Material(door_03_rend[1]);
|
||||
greenMat.SetColor("_EmissionColor", new Color(9f / 255f, 82f / 255f, 4f / 255f));
|
||||
greenMaterials.Add(greenMat);
|
||||
}
|
||||
else if (this.name == "door_04")
|
||||
{
|
||||
Material[] door_04_rend = GameObject.Find("Copter/Fuzeliazh/Door_04/door_04").GetComponent<Renderer>().materials;
|
||||
Material greenMat = new Material(door_04_rend[1]);
|
||||
greenMat.SetColor("_EmissionColor", new Color(9f / 255f, 82f / 255f, 4f / 255f));
|
||||
greenMaterials.Add(greenMat);
|
||||
}
|
||||
else
|
||||
{
|
||||
Material greenMat = new Material(renderer.material); //activeMaterial // renderer.material
|
||||
greenMat.SetColor("_EmissionColor", new Color(9f / 255f, 82f / 255f, 4f / 255f));
|
||||
greenMaterials.Add(greenMat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RestoreChildrenMaterials()
|
||||
{
|
||||
for (int i = 0; i < renderers.Length; i++)
|
||||
{
|
||||
renderers[i].material = materials[i];
|
||||
}
|
||||
materialsReplaced = false;
|
||||
}
|
||||
|
||||
public void ReplaceMaterialsWithActive()
|
||||
{
|
||||
//Debug.Log("ReplaceMaterialsWithActive: " + this.name);
|
||||
if (activeMaterial != null)
|
||||
{
|
||||
for (int i = 0; i < renderers.Length; i++)
|
||||
renderers[i].material = greenMaterials[i]; // = activeMaterial;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Active Material is not set!");
|
||||
}
|
||||
materialsReplaced = true;
|
||||
}
|
||||
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
if (man.mode == "scedit" || man.mode == "play") return;
|
||||
// Скрываем люки под которыми спрятаны панели. Еще не решили нужно ли
|
||||
if (this.transform.parent.gameObject.name == "Group019" || this.transform.parent.gameObject.name == "Group020") this.transform.parent.gameObject.SetActive(false);
|
||||
|
||||
//if (man.mode == "scedit") return;
|
||||
//Debug.Log(this.transform.parent.name + " кликаю панель");
|
||||
//Здесь проверку на not null сделать. Не все активные области являются панелями.
|
||||
if (string.Compare(this.transform.parent.name.Substring(this.transform.parent.name.Length - 2), "3D") == 0 && this.transform.parent.name != null)
|
||||
{
|
||||
string panel2d = this.transform.parent.name.Substring(0, this.transform.parent.name.Length - 3);
|
||||
//Debug.Log("MakeActive: " + panel2d);
|
||||
|
||||
// Может тут подвязать наш канвас и обзорку Максима
|
||||
|
||||
//man.cabines2d.SetActive(true);
|
||||
//man.canvas.SetActive(true);
|
||||
//man.fusel.SetActive(false);
|
||||
man.SwitchTo2D(panel2d);
|
||||
}
|
||||
}
|
||||
|
||||
private void FindAndAddCoverVertical()
|
||||
{
|
||||
string s1 = this.transform.parent.name.Substring(this.transform.parent.name.Length - 7); // окончание названия панели например 0506_3D
|
||||
string s2 = "Cover";
|
||||
GameObject[] cover3Dv = GameObject.FindGameObjectsWithTag("cover3Dv");
|
||||
foreach (GameObject _cover3Dv in cover3Dv)
|
||||
{
|
||||
if (_cover3Dv.name.EndsWith(s1) && _cover3Dv.name.StartsWith(s2))
|
||||
{
|
||||
//Debug.Log(_cover3Dv.name);
|
||||
_cover3Dv.AddComponent<Cover3DVrotate>();
|
||||
//switchesList3D.Add(sw.name, sw);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void FindAndAddCoverHorizontal()
|
||||
{
|
||||
string s1 = this.transform.parent.name.Substring(this.transform.parent.name.Length - 7); // окончание названия панели например 0506_3D
|
||||
string s2 = "Cover";
|
||||
GameObject[] cover3Dh = GameObject.FindGameObjectsWithTag("cover3Dh");
|
||||
foreach (GameObject _cover3Dh in cover3Dh)
|
||||
{
|
||||
if (_cover3Dh.name.EndsWith(s1) && _cover3Dh.name.StartsWith(s2))
|
||||
{
|
||||
//Debug.Log(_cover3Dh.name);
|
||||
_cover3Dh.AddComponent<Cover3DHrotate>();
|
||||
//_cover3Dh.AddComponent<Animation>();
|
||||
//switchesList3D.Add(sw.name, sw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FindAndAddSwitchVertikal()
|
||||
{
|
||||
string s1 = this.transform.parent.name.Substring(this.transform.parent.name.Length - 7); // окончание названия панели например 0506_3D
|
||||
string s2 = "Tumbler";
|
||||
GameObject[] switches3D = GameObject.FindGameObjectsWithTag("toggle3D");
|
||||
foreach (GameObject sw in switches3D)
|
||||
{
|
||||
if (sw.name.EndsWith(s1) && sw.name.StartsWith(s2))
|
||||
{
|
||||
//Debug.Log(sw.name);
|
||||
sw.AddComponent<Switch3DRotate>();
|
||||
switchesList3D.Add(sw.name, sw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FindAndAddSwitchHorizontal()
|
||||
{
|
||||
string s1 = this.transform.parent.name.Substring(this.transform.parent.name.Length - 7); // окончание названия панели например 0506_3D
|
||||
string s2 = "Tumbler";
|
||||
GameObject[] switches3Dh = GameObject.FindGameObjectsWithTag("toggle3Dh");
|
||||
foreach (GameObject _switches3Dh in switches3Dh)
|
||||
{
|
||||
if (_switches3Dh.name.EndsWith(s1) && _switches3Dh.name.StartsWith(s2))
|
||||
{
|
||||
//Debug.Log(sw.name);
|
||||
_switches3Dh.AddComponent<Switch3DHRotate>();
|
||||
switchesList3Dh.Add(_switches3Dh.name, _switches3Dh);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -88,7 +87,7 @@ public class ScEditor : MonoBehaviour
|
||||
//changeMode(1);
|
||||
|
||||
// при сборке редактора сценариев закоментировать:
|
||||
scLoad("qwe"); man.mouseExitUI();
|
||||
//scLoad("qwe"); man.mouseExitUI();
|
||||
|
||||
|
||||
}
|
||||
@@ -763,763 +762,3 @@ public class ScEditor : MonoBehaviour
|
||||
return res;
|
||||
}
|
||||
}
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Xml.Serialization;
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Xml;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.EventSystems;
|
||||
//using UnityEngine.UIElements;
|
||||
|
||||
|
||||
|
||||
public class ScEditor : MonoBehaviour
|
||||
{
|
||||
public Scenario SC;
|
||||
public Manager man;
|
||||
Player player;
|
||||
public GameObject go_scDropdown, go_scExecDropdown, go_initPush, go_demoPush, go_trainPush, go_examPush, go_scNameInput, go_scTitleInput;
|
||||
public GameObject go_objName, go_objType, go_objDescript, go_objState, go_objAudioDropdown;
|
||||
ScrollViewAdapter actionsView;
|
||||
public GameObject curGO;
|
||||
public UnityObject curObject;
|
||||
Renderer[] curObjRenderers;
|
||||
List<Material> curObjMaterials = new List<Material>();
|
||||
List<Material> curObjGreenMaterials = new List<Material>();
|
||||
SpriteRenderer[] curObjSpriteRenderers;
|
||||
Image[] curObjImages;
|
||||
TextMeshPro[] curObjTMPs;
|
||||
List<Color> curObjSpriteColors = new List<Color>();
|
||||
List<Color> curObjImageColors = new List<Color>();
|
||||
List<Color> curObjTMPColors = new List<Color>();
|
||||
bool curObjFlashState = true;
|
||||
bool canChangeScDropdownVal = true;
|
||||
GameObject viewCamera, cabinCamera;
|
||||
|
||||
void Start()
|
||||
{
|
||||
man = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
player = man.player;
|
||||
if (man.mode != "scedit")
|
||||
{
|
||||
GameObject.Find("EditorCanvas").SetActive(false);
|
||||
return;
|
||||
}
|
||||
if (Application.platform == RuntimePlatform.WebGLPlayer)
|
||||
{
|
||||
Debug.LogError("Cannot run scEdit mode in WebGL");
|
||||
GameObject.Find("EditorCanvas").SetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
curObject = null;
|
||||
//Debug.Log("ScEditor.Start: InvokeRepeating FlashCurrentObject");
|
||||
InvokeRepeating("FlashCurrentObject", 0, 0.5f); // CancelInvoke (methodName : string)
|
||||
|
||||
player.SC = new Scenario(); SC = player.SC;
|
||||
SC.title = "Новый сценарий"; SC.name = SC.title; scModifyed("");
|
||||
GameObject.Find("Panel1Content").GetComponent<ScrollViewAdapterPanel1>().Init();
|
||||
GameObject.Find("ActsViewContent").GetComponent<ScrollViewAdapter>().Init();
|
||||
|
||||
GameObject.Find("pathLbl").GetComponent<Text>().text = Path.Combine(Application.streamingAssetsPath, "Scenario");
|
||||
go_scDropdown = GameObject.Find("ScDropdown");
|
||||
go_scExecDropdown = GameObject.Find("DropdownCallScenario");
|
||||
go_objAudioDropdown = GameObject.Find("DropdownPlayAudio");
|
||||
|
||||
// dropdown.value = dropdown.options.FindIndex(option => options.text == "an Option");
|
||||
go_initPush = GameObject.Find("InitPush");
|
||||
go_demoPush = GameObject.Find("DemoPush");
|
||||
go_trainPush = GameObject.Find("TrainPush");
|
||||
go_examPush = GameObject.Find("ExamPush");
|
||||
go_scTitleInput = GameObject.Find("ScTitleInput");
|
||||
go_scNameInput = GameObject.Find("ScNameInput");
|
||||
actionsView = GameObject.Find("ActsViewContent").GetComponent<ScrollViewAdapter>();
|
||||
go_objName = GameObject.Find("IFObjName");
|
||||
go_objType = GameObject.Find("IFObjType");
|
||||
go_objDescript = GameObject.Find("IFObjDescr");
|
||||
go_objState = GameObject.Find("IFObjState");
|
||||
viewCamera = man.viewCamera;
|
||||
cabinCamera = man.cabinCamera;
|
||||
|
||||
FillScDropdown();
|
||||
go_scDropdown.GetComponent<Dropdown>().value = -1; go_scDropdown.GetComponent<Dropdown>().value = 0;
|
||||
SC.isModifyed = false; GameObject.Find("ScSaveButton").GetComponent<Button>().interactable = false;
|
||||
|
||||
//changeMode(1);
|
||||
|
||||
// при сборке редактора сценариев закоментировать:
|
||||
scLoad("qwe"); man.mouseExitUI();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
GameObject curCamera;
|
||||
if (cabinCamera.activeInHierarchy)
|
||||
curCamera = cabinCamera;
|
||||
else
|
||||
curCamera = viewCamera;
|
||||
Ray ray = curCamera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit))
|
||||
if (hit.transform.gameObject != null && hit.transform.gameObject.layer != LayerMask.NameToLayer("Ignore Raycast"))
|
||||
{
|
||||
//if (hit.rigidbody != null)
|
||||
// hit.rigidbody.AddForceAtPosition(- hit.normal * 25, hit.point);//ray.direction hit.point
|
||||
SetCurObject(hit.transform.gameObject);
|
||||
//Debug.Log("~Clicked " + hit.transform.gameObject.name);
|
||||
}
|
||||
}
|
||||
if (Input.GetMouseButtonDown(2))
|
||||
{
|
||||
GameObject curCamera;
|
||||
if (cabinCamera.activeInHierarchy)
|
||||
curCamera = cabinCamera;
|
||||
else
|
||||
curCamera = viewCamera;
|
||||
Ray ray = curCamera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit))
|
||||
if (hit.transform.gameObject != null && hit.transform.gameObject.layer != LayerMask.NameToLayer("Ignore Raycast")) // переделать Ignore Raycast
|
||||
{
|
||||
SetCurObject(hit.transform.gameObject);
|
||||
UnityObject handlerObj = man.objects.FindHandler(hit.transform.gameObject.name);
|
||||
if(handlerObj == null)
|
||||
{
|
||||
Debug.LogError("Handler объекта " + hit.transform.gameObject.name + " не найден.");
|
||||
return;
|
||||
}
|
||||
string handler3D = handlerObj.name;
|
||||
//Debug.Log("Open 2D: clicked " + hit.transform.gameObject.name + ", handler " + handler3D);
|
||||
if (handler3D.Substring(handler3D.Length - 3) == "_3D")
|
||||
{
|
||||
string panel2D = handler3D.Substring(0, handler3D.Length - 3);
|
||||
//Debug.Log("Open 2D: panel2D = " + panel2D);
|
||||
UnityObject obj2D = man.objects.Find(panel2D);
|
||||
if(obj2D != null)
|
||||
man.SwitchTo2D(obj2D.name);
|
||||
else
|
||||
Debug.Log("Не могу найти 2D-панель: " + panel2D);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(KeyCode.Space) && Input.GetKey(KeyCode.LeftControl))
|
||||
GameObject.Find("ButtonWaitForTime").GetComponent<Button>().onClick.Invoke();
|
||||
if (Input.GetKeyUp(KeyCode.Q) && Input.GetKey(KeyCode.LeftControl))
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public void SetCurObject(GameObject go)
|
||||
{
|
||||
//Debug.Log("Loaded = " + man.objects.isLoaded);
|
||||
if (man.objects == null)
|
||||
{
|
||||
Debug.Log("SetCurObject: objects = null. WTF?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (go == null)
|
||||
{
|
||||
SetDefaultMaterialsToCurrentObject();
|
||||
go_objName.GetComponent<TMP_InputField>().text = "";
|
||||
go_objType.GetComponent<TMP_InputField>().text = "";
|
||||
go_objDescript.GetComponent<TMP_InputField>().text = "";
|
||||
go_objState.GetComponent<TMP_InputField>().text = "";
|
||||
go_scExecDropdown.GetComponent<Dropdown>().value = -1;
|
||||
GameObject.Find("Panel1Content").GetComponent<ScrollViewAdapterPanel1>().UpdateItems();
|
||||
curObject = null;
|
||||
return;
|
||||
}
|
||||
//Debug.Log("SetCurObject: " + go.name);
|
||||
|
||||
UnityObject tmpObject = man.objects.FindHandler(go.name);
|
||||
if (tmpObject == null) return;
|
||||
//Debug.Log(go.name + " " + tmpObject.name);
|
||||
//curObject = null;
|
||||
SetDefaultMaterialsToCurrentObject();
|
||||
curObject = tmpObject;
|
||||
//Debug.Log("SetCurObject: clicked " + go.name + ", handler " + curObject.name);
|
||||
|
||||
SetNewMaterialsToCurrentObject(curObject.gameObject);
|
||||
|
||||
//Debug.Log("SetCurObject: '" + curObject.name + "' '" + curObject.type + "' '" + curObject.description + "' " + curObject.curState);
|
||||
|
||||
go_objName.GetComponent<TMP_InputField>().text = curObject.name;
|
||||
go_objType.GetComponent<TMP_InputField>().text = curObject.type;
|
||||
go_objDescript.GetComponent<TMP_InputField>().text = "";
|
||||
if (curObject.description != null)
|
||||
go_objDescript.GetComponent<TMP_InputField>().text = curObject.description.text;
|
||||
int stateMin = -1; int stateMax = -1;
|
||||
//if (curObject.defaultState != null)
|
||||
// curObject.curState = curObject.defaultState.value;
|
||||
//else
|
||||
// curObject.curState = 0;
|
||||
|
||||
go_objState.GetComponent<TMP_InputField>().text = "Не определено";
|
||||
go_scExecDropdown.GetComponent<Dropdown>().value = -1;
|
||||
|
||||
bool isStates = true;
|
||||
if (curObject.states == null || curObject.states.Count == 0) isStates = false;
|
||||
|
||||
if (curObject.stateInRange != null && !isStates)
|
||||
{
|
||||
stateMin = curObject.stateInRange.min; stateMax = curObject.stateInRange.max;
|
||||
//Debug.Log("stateRange: curState " + curObject.curState + " min " + stateMin + " max " + stateMax);
|
||||
if (curObject.curState >= stateMin && curObject.curState <= stateMax)
|
||||
go_objState.GetComponent<TMP_InputField>().text = curObject.curState.ToString();
|
||||
}
|
||||
if (isStates)
|
||||
{
|
||||
stateMin = 0; stateMax = curObject.states.Count-1;
|
||||
if (curObject.curState >= stateMin && curObject.curState <= stateMax)
|
||||
go_objState.GetComponent<TMP_InputField>().text = curObject.states[curObject.curState].name;
|
||||
}
|
||||
if(GameObject.Find("SaveObjectsXMLBtn") !=null && GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>() != null)
|
||||
GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>().interactable = false;
|
||||
|
||||
GameObject.Find("Panel1Content").GetComponent<ScrollViewAdapterPanel1>().UpdateItems();
|
||||
}
|
||||
|
||||
void FlashCurrentObject()
|
||||
{
|
||||
if (curObject == null) return;
|
||||
if (curObject.dim == "3D" && curObjRenderers == null) return;
|
||||
foreach (Player.highlightObj ho in player.highlightList)
|
||||
if (ho.obj == curObject) return;
|
||||
if (curObjFlashState && player.state != "play")
|
||||
{
|
||||
if (curObject.dim == "3D")
|
||||
for (int i = 0; i < curObjRenderers.Length; i++)
|
||||
curObjRenderers[i].material = curObjGreenMaterials[i];
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < curObjSpriteRenderers.Length; i++)
|
||||
if(!curObjSpriteRenderers[i].name.Contains("Indicator"))
|
||||
curObjSpriteRenderers[i].color = Color.green; //yellow
|
||||
else
|
||||
curObjSpriteRenderers[i].color = Color.white;
|
||||
for (int i = 0; i < curObjImages.Length; i++)
|
||||
curObjImages[i].color = Color.green; //green
|
||||
for (int i = 0; i < curObjTMPs.Length; i++)
|
||||
curObjTMPs[i].color = Color.white;
|
||||
}
|
||||
}
|
||||
else
|
||||
SetDefaultMaterialsToCurrentObject();
|
||||
curObjFlashState = !curObjFlashState;
|
||||
}
|
||||
|
||||
void SetNewMaterialsToCurrentObject(GameObject go)
|
||||
{
|
||||
if (curObject.dim == "3D")
|
||||
{
|
||||
curObjRenderers = go.transform.GetComponentsInChildren<Renderer>(); //parent.
|
||||
foreach (Renderer r in curObjRenderers)
|
||||
{
|
||||
|
||||
MakeActive obj_ma = r.gameObject.GetComponent<MakeActive>();
|
||||
if(obj_ma != null)
|
||||
if(obj_ma.materialsReplaced)
|
||||
obj_ma.RestoreChildrenMaterials();
|
||||
}
|
||||
//if (go.GetComponent<MakeActive>().materialsReplaced)
|
||||
// go.GetComponent<MakeActive>().RestoreChildrenMaterials();
|
||||
|
||||
curObjMaterials.Clear(); curObjGreenMaterials.Clear();
|
||||
for (int i = 0; i < curObjRenderers.Length; i++)
|
||||
{
|
||||
curObjMaterials.Add(curObjRenderers[i].material);
|
||||
Material greenMat = new Material(curObjRenderers[i].material);
|
||||
greenMat.SetColor("_EmissionColor", new Color(0 / 255f, 50f / 255f, 0f / 255f)); // 0 50 0
|
||||
curObjGreenMaterials.Add(greenMat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
curObjSpriteRenderers = go.transform.GetComponentsInChildren<SpriteRenderer>(); //parent.
|
||||
curObjImages = go.transform.GetComponentsInChildren<Image>();
|
||||
curObjTMPs = go.transform.GetComponentsInChildren<TextMeshPro>();
|
||||
Indicator[] indicatorList = go.transform.GetComponentsInChildren<Indicator>();
|
||||
for (int i = 0; i < indicatorList.Length; i++) {
|
||||
UnityObject indUO = man.objects.Find(indicatorList[i].gameObject.name);
|
||||
if(indUO != null)
|
||||
man.objects.SetCurrentValues(indUO); //RepaintNumberIndicator();
|
||||
}
|
||||
curObjSpriteColors.Clear(); curObjImageColors.Clear(); curObjTMPColors.Clear();
|
||||
for (int i = 0; i < curObjSpriteRenderers.Length; i++)
|
||||
curObjSpriteColors.Add(curObjSpriteRenderers[i].color);
|
||||
for (int i = 0; i < curObjImages.Length; i++)
|
||||
curObjImageColors.Add(curObjImages[i].color);
|
||||
for (int i = 0; i < curObjTMPs.Length; i++)
|
||||
curObjTMPColors.Add(curObjTMPs[i].color);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDefaultMaterialsToCurrentObject()
|
||||
{
|
||||
if (curObject == null) return;
|
||||
if (curObject.dim == "3D")
|
||||
{
|
||||
if (curObjRenderers == null) return;
|
||||
if (curObjMaterials.Count == 0) return;
|
||||
for (int i = 0; i < curObjRenderers.Length; i++)
|
||||
curObjRenderers[i].material = curObjMaterials[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < curObjSpriteRenderers.Length; i++)
|
||||
curObjSpriteRenderers[i].color = curObjSpriteColors[i];
|
||||
for (int i = 0; i < curObjImages.Length; i++)
|
||||
curObjImages[i].color = curObjImageColors[i];
|
||||
for (int i = 0; i < curObjTMPs.Length; i++)
|
||||
curObjTMPs[i].color = curObjTMPColors[i];
|
||||
}
|
||||
}
|
||||
public void Clicked2D(BaseEventData evData)
|
||||
{
|
||||
if (man.mode != "scedit") return;
|
||||
|
||||
RaycastHit2D hit;
|
||||
Ray ray = GameObject.Find("Camera").GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
hit = Physics2D.Raycast(ray.origin, Vector2.up);
|
||||
if (hit.transform != null)
|
||||
SetCurObject(hit.transform.gameObject);
|
||||
|
||||
PointerEventData _pointer = evData as PointerEventData;
|
||||
switch (_pointer.button)
|
||||
{
|
||||
case PointerEventData.InputButton.Left:
|
||||
break;
|
||||
case PointerEventData.InputButton.Right:
|
||||
break;
|
||||
case PointerEventData.InputButton.Middle:
|
||||
if (curObject == null) break;
|
||||
Cover coverObj = curObject.gameObject.GetComponent<Cover>();
|
||||
if (coverObj != null)
|
||||
curObject.SetObjectState(1);
|
||||
Cover2 cover2Obj = curObject.gameObject.GetComponent<Cover2>();
|
||||
if (cover2Obj != null)
|
||||
curObject.SetObjectState(1);
|
||||
//Debug.Log("Open Cover: " + curObject.name);
|
||||
|
||||
if (curObject != null && curObject.type == "cubeButton")
|
||||
curObject.gameObject.GetComponent<ButtonCubik>().ChangeView();
|
||||
|
||||
if (curObject.name.StartsWith("mfi") && curObject.type == "buttonAutoUncheck") // кнопки переключения экранов МФИ (mfi1Button1)
|
||||
player.SetObjectState(curObject, 1);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnObjectDescrChange(string newstr)
|
||||
{
|
||||
if (go_objDescript.GetComponent<TMP_InputField>().text != "")
|
||||
{
|
||||
if (curObject.description == null)
|
||||
curObject.description = new ObjectDescription();
|
||||
curObject.description.text = go_objDescript.GetComponent<TMP_InputField>().text;
|
||||
}
|
||||
if (GameObject.Find("SaveObjectsXMLBtn") != null && GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>() != null)
|
||||
GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>().interactable = true;
|
||||
}
|
||||
public void OnObjectTypeChange(string _)
|
||||
{
|
||||
//curObject.type = go_objType.GetComponent<TMP_InputField>().text;
|
||||
if(GameObject.Find("SaveObjectsXMLBtn") !=null && GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>()!=null)
|
||||
GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>().interactable = true;
|
||||
}
|
||||
public void scSave()
|
||||
{
|
||||
SC.isModifyed = false; GameObject.Find("ScSaveButton").GetComponent<Button>().interactable = false;
|
||||
if(SC.name == go_scNameInput.GetComponent<TMP_InputField>().text)
|
||||
{
|
||||
SC.title = go_scTitleInput.GetComponent<TMP_InputField>().text;
|
||||
SC.needExamCompleted = GameObject.Find("needExamCheck").GetComponent<UnityEngine.UI.Toggle>().isOn;
|
||||
Serialize(SC, Path.Combine(Application.streamingAssetsPath, "Scenario", SC.name + ".xml"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SC.name = go_scNameInput.GetComponent<TMP_InputField>().text;
|
||||
SC.title = go_scTitleInput.GetComponent<TMP_InputField>().text;
|
||||
SC.needExamCompleted = GameObject.Find("needExamCheck").GetComponent<UnityEngine.UI.Toggle>().isOn;
|
||||
Serialize(SC, Path.Combine(Application.streamingAssetsPath, "Scenario", SC.name + ".xml"));
|
||||
|
||||
int ind = 0;
|
||||
FillScDropdown();
|
||||
Dropdown.OptionData dt;
|
||||
for(int i=0;i< go_scDropdown.GetComponent<Dropdown>().options.Count;i++)
|
||||
{
|
||||
dt = go_scDropdown.GetComponent<Dropdown>().options[i];
|
||||
if (dt.text == SC.name)
|
||||
ind = i;
|
||||
}
|
||||
go_scDropdown.GetComponent<Dropdown>().value = -1; go_scDropdown.GetComponent<Dropdown>().value = ind;
|
||||
}
|
||||
|
||||
changeMode(SC.curMode);
|
||||
}
|
||||
|
||||
public bool scLoad(string scName)
|
||||
{
|
||||
SC.init.acts.Clear(); SC.demo.acts.Clear(); SC.train.acts.Clear(); SC.exam.acts.Clear();
|
||||
string fn = Path.Combine(Application.streamingAssetsPath, "Scenario", scName + ".xml");
|
||||
if (CanDeserialize<Scenario>(fn))
|
||||
{
|
||||
//player.SC = Deserialize<Scenario>(fn);
|
||||
player.LoadScenario(scName);
|
||||
SC = player.SC;
|
||||
SC.name = scName;
|
||||
SC.isModifyed = false; GameObject.Find("ScSaveButton").GetComponent<Button>().interactable = false;
|
||||
go_scNameInput.GetComponent<TMP_InputField>().text = SC.name;
|
||||
go_scTitleInput.GetComponent<TMP_InputField>().text = SC.title;
|
||||
GameObject.Find("needExamCheck").GetComponent<UnityEngine.UI.Toggle>().isOn = SC.needExamCompleted;
|
||||
changeMode(1);
|
||||
|
||||
int ind = 0;
|
||||
Dropdown.OptionData dt;
|
||||
for (int i = 0; i < go_scDropdown.GetComponent<Dropdown>().options.Count; i++)
|
||||
{
|
||||
dt = go_scDropdown.GetComponent<Dropdown>().options[i];
|
||||
if (dt.text == SC.name)
|
||||
ind = i;
|
||||
}
|
||||
canChangeScDropdownVal = false;
|
||||
go_scDropdown.GetComponent<Dropdown>().value = ind;
|
||||
canChangeScDropdownVal = true;
|
||||
//GameObject.Find("ScDropdownLabel").GetComponent<Text>().text = SC.name;
|
||||
|
||||
// список аудио для левой панели
|
||||
Dropdown audioDD = go_objAudioDropdown.GetComponent<Dropdown>();
|
||||
audioDD.ClearOptions();
|
||||
List<Dropdown.OptionData> audioList = new List<Dropdown.OptionData>();
|
||||
Dropdown.OptionData od;
|
||||
DirectoryInfo di = new DirectoryInfo(Path.Combine(Application.streamingAssetsPath, "Scenario", SC.name));
|
||||
FileInfo[] files = new FileInfo[0];
|
||||
|
||||
try
|
||||
{
|
||||
files = di.GetFiles("*.*", SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
catch (IOException) //IOException ioex
|
||||
{
|
||||
//Debug.Log($"exception: {ioex.Message}");
|
||||
}
|
||||
od = new Dropdown.OptionData();
|
||||
od.text = ""; audioList.Add(od);
|
||||
foreach (FileInfo file in files)
|
||||
if (file.Extension == ".wav" || file.Extension == ".mp3")
|
||||
{
|
||||
od = new Dropdown.OptionData();
|
||||
od.text = file.Name;
|
||||
audioList.Add(od);
|
||||
}
|
||||
audioDD.AddOptions(audioList);
|
||||
audioDD.value = 0;
|
||||
|
||||
player.state = "ready";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public void scDelete()
|
||||
{
|
||||
player.ScenarioMsg5sec("По просьбам пострадавших пользователей автоматическое удаление сценария не выполняется.\nВы можете самостоятельно удалить файл сценария:\n" + Application.streamingAssetsPath+"/Scenario/"+SC.name+".xml");
|
||||
|
||||
/* SC.name = go_scNameInput.GetComponent<TMP_InputField>().text;
|
||||
string fn = Path.Combine(Application.streamingAssetsPath, "Scenario", SC.name + ".xml");
|
||||
if (File.Exists(fn))
|
||||
File.Delete(fn);
|
||||
FillScDropdown();
|
||||
go_scDropdown.GetComponent<Dropdown>().value = 0; */
|
||||
}
|
||||
|
||||
private void FillScDropdown()
|
||||
{
|
||||
go_scDropdown.GetComponent<Dropdown>().options.Clear();
|
||||
go_scExecDropdown.GetComponent<Dropdown>().options.Clear();
|
||||
go_scDropdown.GetComponent<Dropdown>().options.Add(new Dropdown.OptionData("new scenario"));
|
||||
DirectoryInfo di = new DirectoryInfo(Path.Combine(Application.streamingAssetsPath, "Scenario"));
|
||||
FileInfo[] files = di.GetFiles("*.xml", SearchOption.TopDirectoryOnly);
|
||||
foreach (FileInfo file in files)
|
||||
if(CanDeserialize<Scenario>(file.FullName))
|
||||
{
|
||||
string scName = file.Name; scName = scName.Remove(scName.IndexOf(file.Extension));
|
||||
go_scDropdown.GetComponent<Dropdown>().options.Add(new Dropdown.OptionData(scName));
|
||||
if(scName != SC.name) // список сценарием для левой панели
|
||||
go_scExecDropdown.GetComponent<Dropdown>().options.Add(new Dropdown.OptionData(scName));
|
||||
}
|
||||
}
|
||||
|
||||
public void changeMode(int mode)
|
||||
{
|
||||
SC.curMode = mode;
|
||||
go_initPush.SetActive(false); go_demoPush.SetActive(false); go_trainPush.SetActive(false); go_examPush.SetActive(false);
|
||||
if (mode == 0) { go_initPush.SetActive(true); SC.curModeSc = SC.init; }
|
||||
if (mode == 1) { go_demoPush.SetActive(true); SC.curModeSc = SC.demo; man.player.SetMode("demo"); }
|
||||
if (mode == 2) { go_trainPush.SetActive(true); SC.curModeSc = SC.train; man.player.SetMode("train"); }
|
||||
if (mode == 3) { go_examPush.SetActive(true); SC.curModeSc = SC.exam; man.player.SetMode("exam"); }
|
||||
// заполнение списка действий
|
||||
actionsView.UpdateItems();
|
||||
}
|
||||
|
||||
public void ScDropdownChanged()
|
||||
{
|
||||
if (!canChangeScDropdownVal) return;
|
||||
GameObject.Find("ScDeleteButton").GetComponent<Button>().interactable = false; ;
|
||||
int value = go_scDropdown.GetComponent<Dropdown>().value;
|
||||
if (value < 0)
|
||||
return;
|
||||
if (value == 0)
|
||||
{
|
||||
CreateNewScenario();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!scLoad(go_scDropdown.GetComponent<Dropdown>().options[value].text))
|
||||
return;
|
||||
GameObject.Find("ScDeleteButton").GetComponent<Button>().interactable = true;
|
||||
return;
|
||||
}
|
||||
|
||||
public void CreateNewScenario()
|
||||
{
|
||||
SC = new Scenario();
|
||||
SC.title = "Новый сценарий";
|
||||
SC.name = "Новый сценарий";
|
||||
go_scNameInput.GetComponent<TMP_InputField>().text = SC.name;
|
||||
go_scTitleInput.GetComponent<TMP_InputField>().text = SC.title;
|
||||
SC.isModifyed = false;
|
||||
changeMode(1);
|
||||
}
|
||||
|
||||
public void scModifyed(string _null="")
|
||||
{
|
||||
SC.isModifyed = true;
|
||||
player.state = "ready";
|
||||
GameObject.Find("ScSaveButton").GetComponent<Button>().interactable = true;
|
||||
}
|
||||
|
||||
public void scModifyed(bool _null)
|
||||
{
|
||||
scModifyed("");
|
||||
}
|
||||
|
||||
public void actionUp()
|
||||
{
|
||||
int curActionInd = actionsView.curAction;
|
||||
if (curActionInd <= 0) return;
|
||||
SC.curModeSc.acts.Insert(curActionInd - 1, SC.curModeSc.acts[curActionInd].clone());
|
||||
SC.curModeSc.acts.RemoveAt(curActionInd + 1);
|
||||
float scrollVal = GameObject.Find("ActionsViewScrollbar").GetComponent<Scrollbar>().value;
|
||||
actionsView.UpdateItems(); actionsView.tap = 0;
|
||||
GameObject.Find("ActionsViewScrollbar").GetComponent<Scrollbar>().value = scrollVal;
|
||||
actionsView.onActionViewChange(curActionInd - 1);
|
||||
scModifyed();
|
||||
}
|
||||
|
||||
public void actionDown()
|
||||
{
|
||||
int curActionInd = actionsView.curAction;
|
||||
if (curActionInd >= SC.curModeSc.acts.Count-1) return;
|
||||
SC.curModeSc.acts.Insert(curActionInd + 2, SC.curModeSc.acts[curActionInd].clone());
|
||||
SC.curModeSc.acts.RemoveAt(curActionInd);
|
||||
float scrollVal = GameObject.Find("ActionsViewScrollbar").GetComponent<Scrollbar>().value;
|
||||
actionsView.UpdateItems(); actionsView.tap = 0;
|
||||
GameObject.Find("ActionsViewScrollbar").GetComponent<Scrollbar>().value = scrollVal;
|
||||
actionsView.onActionViewChange(curActionInd + 1);
|
||||
scModifyed();
|
||||
}
|
||||
public void actionDelete()
|
||||
{
|
||||
int curActionInd = actionsView.curAction;
|
||||
if (curActionInd < 0) return;
|
||||
if (curActionInd >= SC.curModeSc.acts.Count) return;
|
||||
SC.curModeSc.acts.RemoveAt(curActionInd);
|
||||
float scrollVal = GameObject.Find("ActionsViewScrollbar").GetComponent<Scrollbar>().value;
|
||||
actionsView.UpdateItems(); actionsView.tap = 0;
|
||||
GameObject.Find("ActionsViewScrollbar").GetComponent<Scrollbar>().value = scrollVal;
|
||||
if (curActionInd >= SC.curModeSc.acts.Count - 1)
|
||||
curActionInd = SC.curModeSc.acts.Count - 1;
|
||||
actionsView.onActionViewChange(curActionInd);
|
||||
scModifyed();
|
||||
}
|
||||
|
||||
public void ReloadButtonClicked()
|
||||
{
|
||||
man.objects.Load();
|
||||
GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>().interactable = false;
|
||||
}
|
||||
|
||||
public void SaveObjectsButtonClicked()
|
||||
{
|
||||
man.objects.Save();
|
||||
GameObject.Find("SaveObjectsXMLBtn").GetComponent<Button>().interactable = false;
|
||||
}
|
||||
|
||||
public void CopyDemoToLearn()
|
||||
{
|
||||
SC.train.acts.Clear();
|
||||
foreach (ScAction act in SC.demo.acts)
|
||||
SC.train.acts.Add(act.clone());
|
||||
if (SC.curModeSc == SC.train)
|
||||
actionsView.UpdateItems();
|
||||
scModifyed();
|
||||
}
|
||||
public void CopyLearnToExam()
|
||||
{
|
||||
SC.exam.acts.Clear();
|
||||
foreach (ScAction act in SC.train.acts)
|
||||
SC.exam.acts.Add(act.clone());
|
||||
if (SC.curModeSc == SC.exam)
|
||||
actionsView.UpdateItems();
|
||||
scModifyed();
|
||||
}
|
||||
|
||||
public List<ScAction> MakeCurObjectActionsList()
|
||||
{
|
||||
// setState, setStateInRange, openPanel, setTextField, setIntField, switchTo3D, highlightOn, highlightOff,
|
||||
// highlightTime, waitForClick, waitForTime, setCurCameraPos, showText, hideText, execScenario, playAudio
|
||||
List<ScAction> actList = new List<ScAction>();
|
||||
if (curObject == null)
|
||||
return actList;
|
||||
ScAction newAct;
|
||||
|
||||
// setStateInRange
|
||||
bool isStates = true;
|
||||
if (curObject.states == null || curObject.states.Count == 0) isStates = false;
|
||||
|
||||
if (curObject.stateInRange != null && !isStates)
|
||||
if(curObject.name != "Panel0801_3D" && curObject.name != "Panel0802_3D")
|
||||
{
|
||||
newAct = new ScAction(); newAct.type = "setStateInRange";
|
||||
newAct.objName = curObject.name;
|
||||
newAct.title = "[" + curObject.name + "] " + "Установить значение состояния \"___\" за время ____ сек";
|
||||
newAct.setStateInRange = new actSetStateInRange();
|
||||
newAct.setStateInRange.val = 0;
|
||||
newAct.setStateInRange.sec = 0;
|
||||
newAct.setStateInRange.rangeStr = "(" + curObject.stateInRange.min + ".." + curObject.stateInRange.max + ")";
|
||||
actList.Add(newAct);
|
||||
}
|
||||
|
||||
// setState
|
||||
if (isStates)
|
||||
for(int i=0;i< curObject.states.Count;i++)
|
||||
{
|
||||
newAct = new ScAction(); newAct.type = "setState";
|
||||
newAct.objName = curObject.name;
|
||||
newAct.title = "[" + curObject.name + "] " + "Установить состояние \"" + curObject.states[i].name + "\"";
|
||||
newAct.setState = new actSetState();
|
||||
newAct.setState.val = i;
|
||||
newAct.setState.name = curObject.states[i].name;
|
||||
actList.Add(newAct);
|
||||
}
|
||||
|
||||
// setTextField // setIntField
|
||||
if (curObject.type.EndsWith("textField"))
|
||||
{
|
||||
newAct = new ScAction(); newAct.type = "setTextField";
|
||||
newAct.objName = curObject.name;
|
||||
newAct.title = "[" + curObject.name + "] " + "Установить текстовое поле в \"______________\"";
|
||||
newAct.setTextField = new actSetTextField();
|
||||
newAct.setTextField.text = "";
|
||||
actList.Add(newAct);
|
||||
|
||||
newAct = new ScAction(); newAct.type = "setIntField";
|
||||
newAct.objName = curObject.name;
|
||||
newAct.title = "[" + curObject.name + "] " + "Изменить числовое текстовое поле c \"___\" до \"___\" за время ____ сек";
|
||||
newAct.setIntField = new actSetIntField();
|
||||
newAct.setIntField.valFrom = 0; newAct.setIntField.valTo = 0; newAct.setIntField.sec = 0;
|
||||
actList.Add(newAct);
|
||||
|
||||
newAct = new ScAction(); newAct.type = "setFloatField";
|
||||
newAct.objName = curObject.name;
|
||||
newAct.title = "[" + curObject.name + "] " + "Изменить дробное числовое текстовое поле c \"___\" до \"___\" за время ____ сек";
|
||||
newAct.setIntField = new actSetIntField();
|
||||
newAct.setIntField.valFrom = 0; newAct.setIntField.valTo = 0; newAct.setIntField.sec = 0;
|
||||
actList.Add(newAct);
|
||||
}
|
||||
|
||||
// openPanel
|
||||
if (curObject.type == "panel3D" && man.objects.Find(curObject.name.Replace("_3D", "")) != null || curObject.name == "Panel0801_3D" || curObject.name == "Panel0802_3D")
|
||||
{
|
||||
newAct = new ScAction(); newAct.type = "openPanel";
|
||||
newAct.objName = curObject.name; //.Replace("_3D", "")
|
||||
newAct.title = "[" + curObject.name + "] " + "Открыть 2D-панель";
|
||||
actList.Add(newAct);
|
||||
}
|
||||
// switchTo3D
|
||||
if (curObject.type == "panel3D" && man.objects.Find(curObject.name.Replace("_3D", "")) != null || curObject.name == "Panel0801_3D" || curObject.name == "Panel0802_3D")
|
||||
{
|
||||
newAct = new ScAction(); newAct.type = "switchTo3D";
|
||||
newAct.objName = "";
|
||||
newAct.title = "Закрыть 2D-панель";
|
||||
actList.Add(newAct);
|
||||
}
|
||||
|
||||
return actList;
|
||||
}
|
||||
|
||||
public void InsertAction(ScAction act)
|
||||
{
|
||||
SC.curModeSc.acts.Insert(actionsView.curAction + 1, act);
|
||||
int c = actionsView.curAction + 1;
|
||||
if (c >= SC.curModeSc.acts.Count)
|
||||
c = SC.curModeSc.acts.Count - 1;
|
||||
actionsView.UpdateItems(); actionsView.tap = 0;
|
||||
actionsView.onActionViewChange(c);
|
||||
scModifyed();
|
||||
}
|
||||
|
||||
public void Serialize(object item, string path)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.WebGLPlayer) return;
|
||||
|
||||
path = path.Replace("file:///", "");
|
||||
if (path.Contains("http"))
|
||||
{
|
||||
Debug.Log("Cannot serialize to web resource.");
|
||||
return;
|
||||
}
|
||||
XmlSerializer serializer = new XmlSerializer(item.GetType());
|
||||
StreamWriter writer = new StreamWriter(path);
|
||||
serializer.Serialize(writer.BaseStream, item);
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
public T Deserialize<T>(string path)
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
StreamReader reader = new StreamReader(path);
|
||||
T deserialized = (T)serializer.Deserialize(reader.BaseStream);
|
||||
reader.Close();
|
||||
return deserialized;
|
||||
}
|
||||
|
||||
public bool CanDeserialize<T>(string path)
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
Stream fs = new FileStream(path, FileMode.Open);
|
||||
XmlReader reader = new XmlTextReader(fs);
|
||||
bool res = serializer.CanDeserialize(reader);
|
||||
reader.Close();
|
||||
fs.Close();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -103,110 +102,4 @@ public class ClickGruzCube2 : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ClickGruzCube2 : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private float z;
|
||||
private Vector3 startpos, endpos;// = new Vector3(-5.4f, 2.5f, 1.5f);
|
||||
private Coroutine coroutine, coroutine2;
|
||||
float cameraMoveCurTime, cameraMoveMaxTime = 1f;
|
||||
float scrollSpeed = 0.5f;
|
||||
Renderer rend;
|
||||
float eulerAngZ;
|
||||
[HideInInspector] public Manager manager;
|
||||
|
||||
bool flag_rev;
|
||||
public Texture2D SampleTexture;
|
||||
public Texture2D NormalTexture;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
manager = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
endpos =new Vector3(-5.4f, 2.5f,z);
|
||||
rend = GetComponent<Renderer>();
|
||||
rend.enabled = false;
|
||||
eulerAngZ = transform.localEulerAngles.z;
|
||||
RotationArrow();
|
||||
|
||||
flag_rev = false;
|
||||
|
||||
}
|
||||
void OnMouseEnter()
|
||||
{
|
||||
RotationArrow();
|
||||
rend.enabled = true;
|
||||
coroutine2 = StartCoroutine(GoToArrow());
|
||||
}
|
||||
void OnMouseExit()
|
||||
{
|
||||
rend.enabled = false;
|
||||
if (coroutine2 != null) StopCoroutine(coroutine2);
|
||||
}
|
||||
private void OnMouseDown()
|
||||
{
|
||||
if (manager.viewmode == 1) return;
|
||||
cameraMoveCurTime = 0;
|
||||
startpos = Camera.main.transform.position;
|
||||
coroutine = StartCoroutine(GoToCube());
|
||||
}
|
||||
IEnumerator GoToCube()
|
||||
{
|
||||
float d;
|
||||
while (cameraMoveCurTime < cameraMoveMaxTime)
|
||||
{
|
||||
cameraMoveCurTime += Time.deltaTime;
|
||||
d = cameraMoveCurTime / cameraMoveMaxTime;
|
||||
Camera.main.transform.position = Vector3.Lerp(startpos, endpos, d);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
}
|
||||
void RotationArrow()
|
||||
{
|
||||
if (Camera.main.transform.localEulerAngles.y > -90 && Camera.main.transform.localEulerAngles.y < 90|| Camera.main.transform.localEulerAngles.y > 270)
|
||||
{
|
||||
flag_rev = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag_rev = false;
|
||||
}
|
||||
|
||||
}
|
||||
IEnumerator GoToArrow()
|
||||
{
|
||||
while (rend.enabled)
|
||||
{
|
||||
float offset = -Time.time * scrollSpeed;
|
||||
if (flag_rev)
|
||||
{
|
||||
rend.material.SetTexture("_MainTex", SampleTexture);
|
||||
rend.material.SetTextureOffset("_MainTex", new Vector2(-offset, 0));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
rend.material.SetTexture("_MainTex", NormalTexture);
|
||||
rend.material.SetTextureOffset("_MainTex", new Vector2(offset, 0));
|
||||
}
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
}
|
||||
public void FixedUpdate()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (coroutine != null) StopCoroutine(coroutine);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -43,49 +42,3 @@ public class Switch2view : MonoBehaviour, IPointerClickHandler//, IPointerEnterH
|
||||
manager.skv.SetActive(true);
|
||||
}*/
|
||||
}
|
||||
=======
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Switch2view : MonoBehaviour, IPointerClickHandler//, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[HideInInspector] public Manager manager;
|
||||
void Start()
|
||||
{
|
||||
manager = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
/* manager.viewmode = 3; // Свободный обзор
|
||||
//if(manager.mode == "free") manager.mode = "view";
|
||||
//manager.mode = "view";
|
||||
manager.cabines2d.SetActive(false);
|
||||
manager.fusel.SetActive(true);
|
||||
manager.skv.SetActive(true);
|
||||
|
||||
//manager.ViewBackButton.GetComponent<Button>().onClick.Invoke();
|
||||
// Выключаем коллайдеры для внутренней и пассажирской кабины
|
||||
manager.DisablePassCabineCollider();
|
||||
manager.DisablePilotCabineCollider();
|
||||
*/
|
||||
if (manager == null)
|
||||
manager = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
if (!manager.is3D) manager.SwitchTo3D();
|
||||
manager.switchModeView();
|
||||
|
||||
manager.mouseEnterUI();
|
||||
}
|
||||
/*public void OnMouseDown()
|
||||
{
|
||||
manager.viewmode = 3; // Свободный обзор
|
||||
//if (manager.mode == "free") manager.mode = "view";
|
||||
manager.cabines2d.SetActive(false);
|
||||
manager.fusel.SetActive(true);
|
||||
manager.skv.SetActive(true);
|
||||
}*/
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
@@ -85,91 +84,3 @@ public class hint : MonoBehaviour, IPointerEnterHandler, IPointerDownHandler, IP
|
||||
|
||||
}
|
||||
}
|
||||
=======
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class hint : MonoBehaviour, IPointerEnterHandler, IPointerDownHandler, IPointerExitHandler, IPointerUpHandler
|
||||
{
|
||||
[HideInInspector] public Manager manager;
|
||||
public static bool IsHint = true;
|
||||
private Image[] img;
|
||||
|
||||
private GameObject hintObj;
|
||||
public GameObject go;
|
||||
[SerializeField]
|
||||
private string t;
|
||||
void Start()
|
||||
{
|
||||
img = this.GetComponentsInChildren<Image>();
|
||||
img[0].gameObject.SetActive(true);
|
||||
img[1].gameObject.SetActive(false);
|
||||
gameObject.GetComponentInChildren<Image>().color = (IsHint) ? Color.green : Color.white;
|
||||
manager = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
IsHint = !IsHint;
|
||||
gameObject.GetComponentInChildren<Image>().color = (IsHint) ? Color.green : Color.white;
|
||||
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
img[0].gameObject.SetActive(false);
|
||||
img[1].gameObject.SetActive(true);
|
||||
gameObject.GetComponentInChildren<Image>().color = (IsHint) ? Color.green : Color.white;
|
||||
|
||||
var h = GameObject.Find("hintContainer");
|
||||
Debug.Log(h);
|
||||
if (h != null)
|
||||
{
|
||||
Destroy(h);
|
||||
}
|
||||
hintObj = OnHint(this.gameObject, go, t);
|
||||
|
||||
//manager.mouseEnterUI();
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
gameObject.GetComponentInChildren<Image>().color = Color.green;
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
img[0].gameObject.SetActive(true);
|
||||
img[1].gameObject.SetActive(false);
|
||||
gameObject.GetComponentInChildren<Image>().color = (IsHint) ? Color.green : Color.white;
|
||||
Destroy(hintObj);
|
||||
//manager.mouseExitUI();
|
||||
}
|
||||
public GameObject OnHint(GameObject btn, GameObject objGo, string t)
|
||||
{
|
||||
Vector2 hintPos = new Vector2(btn.transform.localPosition.x + 15, btn.transform.localPosition.y + 55);//позиция хинта
|
||||
GameObject hint = Instantiate(objGo, btn.transform.parent);//создание хинта
|
||||
hint.name = "hintContainer";
|
||||
hint.transform.localPosition = hintPos;//позиция хинта устанавливаем
|
||||
var hintBase = hint.GetComponentInChildren<Image>();
|
||||
Text txt = hint.GetComponentInChildren<Text>();
|
||||
txt.text = t;
|
||||
var s = txt.text.Length;
|
||||
//Debug.Log($"s = {s}");
|
||||
RectTransform rectTransformText = txt.GetComponent<RectTransform>();
|
||||
rectTransformText.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s * 10 + 20);
|
||||
RectTransform rectTransformBase = hintBase.GetComponent<RectTransform>();
|
||||
rectTransformBase.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransformText.rect.width + 35);
|
||||
if ((rectTransformBase.rect.width + hintBase.transform.position.x) > Screen.width)
|
||||
{
|
||||
hint.transform.localPosition = new Vector2(hint.transform.localPosition.x - rectTransformBase.rect.width/2 + 25, hint.transform.localPosition.y);
|
||||
var hintTr = hint.transform.GetChild(1).GetComponent<Image>();
|
||||
hintTr.transform.localPosition = new Vector2(hintTr.transform.localPosition.x + rectTransformBase.rect.width/2 - 30, hintTr.transform.localPosition.y);
|
||||
//Debug.Log($"hintTr.name = {hintTr.name}");
|
||||
}
|
||||
return hint;
|
||||
|
||||
}
|
||||
}
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>12121212</title>
|
||||
@@ -24,31 +23,4 @@
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
=======
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>12121212</title>
|
||||
<needExamCompleted>true</needExamCompleted>
|
||||
<init />
|
||||
<demonstration>
|
||||
<action objectName="Panel0116_3D" type="openPanel" title="[Panel0116_3D] Открыть 2D-панель" />
|
||||
<action objectName="mfi3_ButtonB6" type="setState" title="[mfi3_ButtonB6] Установить состояние "Нажата"">
|
||||
<setState val="1" name="Нажата" />
|
||||
</action>
|
||||
<action objectName="mfi3_Indicator3_1" type="setStateInRange" title="[mfi3_Indicator3_1] Установить значение состояния "680"">
|
||||
<setStateInRange val="680" sec="0" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="mfi3_Indicator3_2" type="setStateInRange" title="[mfi3_Indicator3_2] Установить значение состояния "60" за время 20 сек">
|
||||
<setStateInRange val="60" sec="20" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 30 сек">
|
||||
<waitForTime sec="30" />
|
||||
</action>
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
</Scenario>
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>Новый сценарий</title>
|
||||
@@ -31,38 +30,4 @@
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
=======
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>Новый сценарий</title>
|
||||
<needExamCompleted>true</needExamCompleted>
|
||||
<init />
|
||||
<demonstration>
|
||||
<action objectName="Panel1101_3D" type="openPanel" title="[Panel1101_3D] Открыть 2D-панель" />
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="Handle2_1101" type="setState" title="[Handle2_1101] Установить состояние "Вкл."">
|
||||
<setState val="1" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="Handle2_1101" type="setState" title="[Handle2_1101] Установить состояние "Опустить ручку"">
|
||||
<setState val="2" name="Опустить ручку" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="Handle2_1101" type="setState" title="[Handle2_1101] Установить состояние "Опустить ручку нажата"">
|
||||
<setState val="3" name="Опустить ручку нажата" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="" type="switchTo3D" title="Закрыть 2D-панель" />
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
</Scenario>
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>Новый сценарий</title>
|
||||
@@ -38,45 +37,4 @@
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
=======
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>Новый сценарий</title>
|
||||
<needExamCompleted>true</needExamCompleted>
|
||||
<init />
|
||||
<demonstration>
|
||||
<action objectName="" type="setCurCameraPos" title="Установить положение камеры">
|
||||
<setCurCameraPos camera="cabin" fov="50" viewMode="1">
|
||||
<position x="-5.9" y="2.5" z="7.33" />
|
||||
<rotation x="348.431274" y="46.4853172" z="1.30721673E-06" />
|
||||
<scale x="1" y="1" z="1" />
|
||||
</setCurCameraPos>
|
||||
</action>
|
||||
<action objectName="Panel1101_3D" type="openPanel" title="[Panel1101_3D] Открыть 2D-панель" />
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="Handle1_1101" type="setState" title="[Handle1_1101] Установить состояние "Опустить ручку"">
|
||||
<setState val="2" name="Опустить ручку" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="Handle1_1101" type="setState" title="[Handle1_1101] Установить состояние "Вкл."">
|
||||
<setState val="1" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="Handle1_1101" type="setState" title="[Handle1_1101] Установить состояние "Выкл."">
|
||||
<setState val="0" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="" type="switchTo3D" title="Закрыть 2D-панель" />
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
</Scenario>
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>hhh</title>
|
||||
@@ -28,35 +27,4 @@
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
=======
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>hhh</title>
|
||||
<needExamCompleted>true</needExamCompleted>
|
||||
<init />
|
||||
<demonstration>
|
||||
<action objectName="Panel0110_3D" type="openPanel" title="[Panel0110_3D] Открыть 2D-панель" />
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="mfi1_PI_Indicator_2" type="setStateInRange" title="[mfi1_PI_Indicator_2] Установить значение состояния "29" за время 5 сек">
|
||||
<setStateInRange val="29" sec="5" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 5 сек">
|
||||
<waitForTime sec="5" />
|
||||
</action>
|
||||
<action objectName="mfi1_PI_Indicator_2" type="setStateInRange" title="[mfi1_PI_Indicator_2] Установить значение состояния "-29" за время 5 сек">
|
||||
<setStateInRange val="-29" sec="5" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 5 сек">
|
||||
<waitForTime sec="5" />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 1 сек">
|
||||
<waitForTime sec="1" />
|
||||
</action>
|
||||
<action objectName="" type="switchTo3D" title="Закрыть 2D-панель" />
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination />
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
</Scenario>
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>Новый сценарий</title>
|
||||
@@ -31,94 +30,4 @@
|
||||
</action>
|
||||
<action objectName="Panel0801_3D" type="waitForClick" title="[Panel0801_3D] Ожидать нажания на объект" />
|
||||
</examination>
|
||||
=======
|
||||
<?xml version="1.0"?>
|
||||
<Scenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<title>Новый сценарий</title>
|
||||
<needExamCompleted>true</needExamCompleted>
|
||||
<init />
|
||||
<demonstration>
|
||||
<action objectName="Panel3008_3D" type="openPanel" title="[Panel3008_3D] Открыть 2D-панель" />
|
||||
<action objectName="" type="waitForTime" title="Пауза 2 сек">
|
||||
<waitForTime sec="2" />
|
||||
</action>
|
||||
<action objectName="Lamp1_3008" type="setState" title="[Lamp1_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp2_3008" type="setState" title="[Lamp2_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp3_3008" type="setState" title="[Lamp3_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp4_3008" type="setState" title="[Lamp4_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp5_3008" type="setState" title="[Lamp5_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp6_3008" type="setState" title="[Lamp6_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp7_3008" type="setState" title="[Lamp7_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp8_3008" type="setState" title="[Lamp8_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp9_3008" type="setState" title="[Lamp9_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="Lamp10_3008" type="setState" title="[Lamp10_3008] Установить состояние "Выкл."">
|
||||
<setState val="1" name="Выкл." />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 2 сек">
|
||||
<waitForTime sec="2" />
|
||||
</action>
|
||||
<action objectName="Lamp1_3008" type="setState" title="[Lamp1_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp2_3008" type="setState" title="[Lamp2_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp3_3008" type="setState" title="[Lamp3_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp4_3008" type="setState" title="[Lamp4_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp5_3008" type="setState" title="[Lamp5_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp6_3008" type="setState" title="[Lamp6_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp7_3008" type="setState" title="[Lamp7_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp8_3008" type="setState" title="[Lamp8_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp9_3008" type="setState" title="[Lamp9_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="Lamp10_3008" type="setState" title="[Lamp10_3008] Установить состояние "Вкл."">
|
||||
<setState val="0" name="Вкл." />
|
||||
</action>
|
||||
<action objectName="" type="waitForTime" title="Пауза 2 сек">
|
||||
<waitForTime sec="2" />
|
||||
</action>
|
||||
</demonstration>
|
||||
<training />
|
||||
<examination>
|
||||
<action objectName="" type="setCurCameraPos" title="Установить положение камеры">
|
||||
<setCurCameraPos camera="cabin" fov="60" viewMode="1">
|
||||
<position x="-5.9" y="2.5" z="7.33" />
|
||||
<rotation x="41.4833679" y="12.8225117" z="-5.698297E-07" />
|
||||
<scale x="1" y="1" z="1" />
|
||||
</setCurCameraPos>
|
||||
</action>
|
||||
<action objectName="Panel0801_3D" type="waitForClick" title="[Panel0801_3D] Ожидать нажания на объект" />
|
||||
</examination>
|
||||
>>>>>>> 3b1b9479a46e90d056b92897ea9f8422b25fc052
|
||||
</Scenario>
|
||||
Reference in New Issue
Block a user