Merge branch 'master' of http://119.45.94.212:1280/zhuyayu/E_ElecCompetition
This commit is contained in:
commit
ccb966c1b2
|
@ -27,7 +27,7 @@ public static class AsyncWebReq
|
|||
public static void SetValue(string jsonStr, out JObject _jbsx, out JObject _jsxx, out List<JObject> _jlzzxx)
|
||||
{
|
||||
var json = JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonStr);
|
||||
var data = json["data"] as JObject;
|
||||
var data = json["datas"] as JObject;
|
||||
|
||||
var jbsxArr = data["jbsx"] as JArray;
|
||||
var jbsx = jbsxArr[0] as JObject;
|
||||
|
|
|
@ -34766,7 +34766,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &379354441
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -34831,18 +34831,6 @@ MonoBehaviour:
|
|||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 5090827398298492658}
|
||||
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- m_Target: {fileID: 2047386840}
|
||||
m_TargetAssemblyTypeName: UnityEngine.UI.Toggle, UnityEngine.UI
|
||||
m_MethodName: set_isOn
|
||||
|
@ -103168,6 +103156,7 @@ GameObject:
|
|||
- component: {fileID: 1067605742}
|
||||
- component: {fileID: 1067605745}
|
||||
- component: {fileID: 1067605746}
|
||||
- component: {fileID: 1067605747}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
|
@ -103276,6 +103265,7 @@ MonoBehaviour:
|
|||
MobileTerminalController: {fileID: 1067605742}
|
||||
assignmentController: {fileID: 1067605744}
|
||||
bottomCotroller: {fileID: 1067605746}
|
||||
toolModelManager: {fileID: 0}
|
||||
exitBtn: {fileID: 1602550215}
|
||||
backToToolBtn: {fileID: 1505331878}
|
||||
--- !u!114 &1067605742
|
||||
|
@ -103343,8 +103333,11 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
RWPanel: {fileID: 5090827398298492658}
|
||||
rws: {fileID: 7550337382994350724}
|
||||
rwsTip: {fileID: 1464913868116621290}
|
||||
loadBtn: {fileID: 7502760747128527674}
|
||||
closeBtn: {fileID: 379354442}
|
||||
originPos: {x: 0, y: 0}
|
||||
url: http://111.229.30.246:10013/Handler/Taiqu.ashx?action=rws
|
||||
--- !u!114 &1067605745
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -103384,6 +103377,20 @@ MonoBehaviour:
|
|||
- {fileID: 1189450973}
|
||||
buttomPanel: {fileID: 1935876357}
|
||||
BirdEyeView: {fileID: 932668468}
|
||||
--- !u!114 &1067605747
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1067605736}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1bbdc92a427f66b4ab0ae87c35cb0544, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
toolItems: []
|
||||
toolItemContent: {fileID: 1021690653}
|
||||
--- !u!1 &1072268438
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -201301,18 +201308,6 @@ RectTransform:
|
|||
m_AnchoredPosition: {x: -416, y: -65}
|
||||
m_SizeDelta: {x: 1059, y: 585}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7650852213641946357
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9029326305111261340}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 41a6ccb45404ead45a8ec03025263a84, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!222 &8409965097830473489
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -201332,7 +201327,6 @@ GameObject:
|
|||
- component: {fileID: 6346542558084323096}
|
||||
- component: {fileID: 6050573552887945181}
|
||||
- component: {fileID: 1464913868116621290}
|
||||
- component: {fileID: 7650852213641946357}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using AData;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -16,13 +17,21 @@ namespace Adam
|
|||
{
|
||||
public GameObject RWPanel;
|
||||
public RectTransform rws;
|
||||
public Text rwsTip;
|
||||
public Button loadBtn;
|
||||
public Button closeBtn;
|
||||
public Vector2 originPos = new Vector2();
|
||||
|
||||
public string url = "http://111.229.30.246:10013/Handler/Taiqu.ashx?action=rws";
|
||||
private async void Awake()
|
||||
{
|
||||
AssignmentDatas aData = await AsyncWebReq.Get<AssignmentDatas>(url);
|
||||
rwsTip.text = aData.message;
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
originPos = rws.anchoredPosition;
|
||||
loadBtn.onClick.AddListener(OnLoad);
|
||||
closeBtn.onClick.AddListener(() => { SwitchPanel(false); });
|
||||
SwitchPanel(false);
|
||||
}
|
||||
|
||||
|
@ -43,6 +52,7 @@ namespace Adam
|
|||
UIManager.Instance.exitBtn.gameObject.SetActive(true);
|
||||
rws.anchoredPosition = Vector2.zero;
|
||||
loadBtn.gameObject.SetActive(false);
|
||||
closeBtn.gameObject.SetActive(true);
|
||||
SwitchPanel(false);
|
||||
SceneLoad.Instance.SceneChange("工具间场景");
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public class ToolItem : MonoBehaviour
|
|||
public Vector3 originPos = new Vector3();
|
||||
public Vector3 originAngle = new Vector3();
|
||||
public GameObject prefab;
|
||||
public Attribute attribute = Attribute.defaultModel;
|
||||
|
||||
public void SetValue(string name, Transform modelTransform, Action selfCallback = null)
|
||||
{
|
||||
|
@ -36,6 +37,7 @@ public class ToolItem : MonoBehaviour
|
|||
originPos = modelTransform.localPosition;
|
||||
originAngle = modelTransform.localEulerAngles;
|
||||
prefab = Resources.Load<GameObject>("New/Models/" + toolName);
|
||||
attribute = prefab.GetComponent<ToolModelClick>().attribute;
|
||||
}
|
||||
|
||||
public void SetState(bool isActive)
|
||||
|
@ -44,13 +46,32 @@ public class ToolItem : MonoBehaviour
|
|||
selfButton.interactable = !isActive;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断自己是不是可以点击
|
||||
/// </summary>
|
||||
public void SwitchSelfIsClick()
|
||||
{
|
||||
closeButton.gameObject.SetActive(false);
|
||||
if (attribute == Attribute.SafetyToolsAndInstruments)
|
||||
{
|
||||
selfButton.interactable = false;
|
||||
}
|
||||
else if (attribute == Attribute.ToolsAndInstruments)
|
||||
{
|
||||
selfButton.interactable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSelfClick()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Sprite ToSprite(Texture2D t)
|
||||
private Sprite ToSprite(Texture2D t)
|
||||
{
|
||||
Sprite prite = Sprite.Create(t, new Rect(0, 0, t.width, t.height), new Vector2(0.5f, 0.5f));
|
||||
return prite;
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
//============================================================
|
||||
//支持中文,文件使用UTF-8编码
|
||||
//@author YangHua
|
||||
//@create 20230914
|
||||
//@company QianHuo
|
||||
//
|
||||
//@description:
|
||||
//============================================================
|
||||
namespace AData
|
||||
{
|
||||
public class AssignmentDatas
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string state;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string message;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string data;
|
||||
}
|
||||
|
||||
//public class Data
|
||||
//{
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public string id;
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public string content;
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public string r1;
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public string r2;
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public string r3;
|
||||
//}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e7a5cfe53ce946c48a76a316bc4b78bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
//============================================================
|
||||
//支持中文,文件使用UTF-8编码
|
||||
//@author YangHua
|
||||
|
@ -11,17 +12,18 @@ using UnityEngine;
|
|||
//============================================================
|
||||
namespace Data
|
||||
{
|
||||
[Serializable]
|
||||
public class SceneData
|
||||
{
|
||||
public bool state;
|
||||
public string message;
|
||||
public Data data;
|
||||
public bool state { get; private set; }
|
||||
public string message { get; private set; }
|
||||
public string data { get; private set; }
|
||||
}
|
||||
|
||||
public class Data
|
||||
{
|
||||
public string Isguangfu;
|
||||
public string jxfs;
|
||||
public string zhbl;
|
||||
}
|
||||
//public class Data
|
||||
//{
|
||||
// public string Isguangfu;
|
||||
// public string jxfs;
|
||||
// public string zhbl;
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ using UnityEngine;
|
|||
//@description:
|
||||
//============================================================
|
||||
|
||||
public static class Global
|
||||
public class GlobalFlag
|
||||
{
|
||||
|
||||
public SceneData sceneData;
|
||||
}
|
|
@ -17,11 +17,11 @@ namespace QianHuo
|
|||
{
|
||||
public Button goToSceneBtn;
|
||||
public InputField userID;
|
||||
public SceneData sceneData = new SceneData();
|
||||
public string url = "http://111.229.30.246:10013/Handler/Taiqu.ashx?action=changjing&bianhao=";
|
||||
// Use this for initialization
|
||||
private void Start()
|
||||
{
|
||||
OnGo();
|
||||
goToSceneBtn.onClick.AddListener(OnGo);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ namespace QianHuo
|
|||
{
|
||||
string _url = url + userID.text;
|
||||
SceneData data = await AsyncWebReq.Get<SceneData>(_url);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class LoginController : MonoBehaviour
|
|||
//Debug.Log(msg.state);
|
||||
//if (msg.state == "Fail")
|
||||
//{
|
||||
// StartCoroutine(WaitCloseErrorPlane(msg.data[0].msg));
|
||||
// StartCoroutine(WaitCloseErrorPlane(msg.datas[0].msg));
|
||||
// return;
|
||||
//}
|
||||
SwitchPanel(1);
|
||||
|
|
|
@ -12,10 +12,18 @@ using UnityEngine;
|
|||
|
||||
public class ToolModelManager : MonoBehaviour
|
||||
{
|
||||
|
||||
// Use this for initialization
|
||||
private void Start()
|
||||
public ToolItem[] toolItems;
|
||||
public Transform toolItemContent;
|
||||
|
||||
/// <summary>
|
||||
/// 需要3D去调用
|
||||
/// </summary>
|
||||
public void SwitchAllToolItems()
|
||||
{
|
||||
|
||||
toolItems = toolItemContent.GetComponentsInChildren<ToolItem>();
|
||||
for (int i = 0; i < toolItems.Length; i++)
|
||||
{
|
||||
toolItems[i].SwitchSelfIsClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class UIManager : MonoSingleton<UIManager>
|
|||
public MobileTerminalController MobileTerminalController;
|
||||
public AssignmentController assignmentController;
|
||||
public BottomController bottomCotroller;
|
||||
public ToolModelManager toolModelManager;
|
||||
public Button exitBtn;
|
||||
public Button backToToolBtn;
|
||||
// Use this for initialization
|
||||
|
|
|
@ -2,7 +2,10 @@ fileFormatVersion: 2
|
|||
guid: 483e16a8ce5cebd47a3a743327bb5993
|
||||
ModelImporter:
|
||||
serializedVersion: 21300
|
||||
internalIDToNameTable: []
|
||||
internalIDToNameTable:
|
||||
- first:
|
||||
74: 1827226128182048838
|
||||
second: Take 001
|
||||
externalObjects:
|
||||
- first:
|
||||
type: UnityEngine:Material
|
||||
|
|
|
@ -16,7 +16,7 @@ using UnityEngine.UI;
|
|||
|
||||
public class FirstPersonController : MonoBehaviour
|
||||
{
|
||||
private Rigidbody rb;
|
||||
public Rigidbody rb;
|
||||
|
||||
#region Camera Movement Variables
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class FirstPersonController : MonoBehaviour
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
rb =GetComponent<Rigidbody>();
|
||||
|
||||
crosshairObject = GetComponentInChildren<Image>(true);
|
||||
|
||||
|
@ -369,12 +369,12 @@ public class FirstPersonController : MonoBehaviour
|
|||
#endregion
|
||||
|
||||
CheckGround();
|
||||
|
||||
fieldView = playerCamera.fieldOfView;
|
||||
fieldView -= Input.GetAxis("Mouse ScrollWheel") * 10f;
|
||||
fieldView = Mathf.Clamp(fieldView, 20, 60);
|
||||
playerCamera.fieldOfView = fieldView;
|
||||
|
||||
|
||||
if (enableHeadBob)
|
||||
{
|
||||
HeadBob();
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2943890895030514617
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2943890895030514615}
|
||||
- component: {fileID: 2943890894315625057}
|
||||
- component: {fileID: 2943890894315625058}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2943890895030514615
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2943890895030514617}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 28.539894, y: 1.8100001, z: 337.26544}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2943890894315625057
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2943890895030514617}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d38da66309ccf6640acd6bd3ea8ee27a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &2943890894315625058
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2943890895030514617}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e0691636af8b1214b841d5b6bbad0f4f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
content: {fileID: 0}
|
|
@ -0,0 +1,85 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2943890895030514617
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2943890895030514615}
|
||||
- component: {fileID: 2943890894315625056}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2943890895030514615
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2943890895030514617}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 28.539894, y: 1.8100001, z: 337.26544}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2943890894315625056
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2943890895030514617}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b76f2fea1e26daf47800ae5368778726, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
"\u6545\u969C\u8BB0\u5F55\u8868": {fileID: 0}
|
||||
"\u8BBE\u5907": {fileID: 0}
|
||||
"\u8BE6\u7EC6\u7F3A\u9677": {fileID: 0}
|
||||
"\u7F3A\u9677\u7C7B\u578B": {fileID: 0}
|
||||
content: {fileID: 0}
|
||||
"\u914D\u7535\u7BB1":
|
||||
- "\u65E0\u5149\u4F0F\u63A5\u5165\u70B9\u6807\u5FD7"
|
||||
- "\u4F4E\u538B\u5206\u754C\u5F00\u5173\u5F02\u5E38"
|
||||
- "\u8FDB\u51FA\u7EBF\u642D\u63A5\u65E0\u94DC\u7247"
|
||||
- "\u8FDB\u51FA\u7EBF\u642D\u63A5\u7EBF\u7F06\u8FDE\u63A5\u5F02\u5E38"
|
||||
"\u7535\u7EBF\u6746":
|
||||
- "\u65E0\u6746\u53F7"
|
||||
- "\u65E0\u5206\u754C\u70B9\u7F16\u53F7 "
|
||||
"\u5E76\u7F51\u67DC":
|
||||
- "\u8B66\u793A\u6807\u5FD7\u4E0D\u9F50"
|
||||
- "\u67DC\u4F53\u65E0\u63A5\u5730"
|
||||
- "\u67DC\u95E8\u65E0\u63A5\u5730"
|
||||
- "\u901A\u9053\u5185\u90E8\u6709\u6742\u7269"
|
||||
- "\u51FA\u7EBF\u7F16\u53F7\u724C\u7F3A\u5931"
|
||||
- "\u5E76\u7F51\u65AD\u8DEF\u5668\u7684\u5BB9\u91CF\u4E0E\u5BA2\u6237\u7533\u8BF7\u5BB9\u91CF\u4E0D\u76F8\u7B26"
|
||||
- "\u9694\u79BB\u5F00\u5173\u7684\u5BB9\u91CF\u4E0E\u5BA2\u6237\u7533\u8BF7\u5BB9\u91CF\u4E0D\u76F8\u7B26"
|
||||
- "\u5B9E\u65F6\u663E\u793A\u6700\u5927\u7535\u6D41\u6216\u529F\u7387\u8D85\u8FC7\u5907\u6848\u5BB9\u91CF"
|
||||
"\u5E76\u7F51\u8BBE\u5907":
|
||||
- "\u9006\u53D8\u5668\u5408\u8BA1\u5BB9\u91CF\u4E0E\u7528\u6237\u6863\u6848\u4E0D\u4E00\u81F4"
|
||||
- "\u9006\u53D8\u5668\u5916\u58F3\u672A\u63A5\u5730"
|
||||
- "\u9006\u53D8\u5668\u5B58\u5728\u6545\u969C\u62A5\u8B66\u73B0\u8C61"
|
||||
- "\u6C47\u6D41\u7BB1\u5404\u79CD\u51FA\u7EBF\u5F00\u5173\u7684\u63A5\u7EBF\u7EBF\u7F06\u9732\u94DC"
|
||||
- "\u67DC\u4F53\u5C01\u5835\u4E0D\u5B8C\u5584"
|
||||
"\u8BA1\u91CF\u67DC":
|
||||
- "\u8BA1\u91CF\u67DC\u524D\u540E\u95E8\u5C01\u5370\u4E0D\u5B8C\u6574"
|
||||
- "\u67DC\u4F53\u524D\u540E\u95E8\u672A\u5173\u95ED"
|
||||
- "\u8054\u5408\u63A5\u7EBF\u76D2\u5C01\u5370\u4E0D\u9F50\u5168"
|
||||
- "\u8868\u8BA1\u5C01\u5370\u4E0D\u9F50\u5168"
|
||||
- "\u4E92\u611F\u5668\u5C01\u5370\u4E0D\u9F50\u5168"
|
||||
- "\u4E8C\u6B21\u56DE\u8DEF\u5BFC\u7EBF\u4E0D\u89C4\u8303"
|
||||
- "\u4E92\u611F\u5668\u6709\u660E\u663E\u7684\u635F\u574F\u3001\u65AD\u88C2\u3001\u53D8\u5F62\u6216\u8131\u843D"
|
||||
- "\u8868\u8BA1\u51FA\u7EBF\u5230\u8054\u5408\u63A5\u7EBF\u76D2\u4E4B\u95F4\u7EBF\u7F06\u9732\u94DC"
|
||||
- "\u8054\u5408\u63A5\u7EBF\u76D2\u81F3\u4E92\u611F\u5668\u4E4B\u95F4\u7684\u63A5\u7EBF\u7EBF\u7F06\u9732\u94DC"
|
||||
- "\u8868\u8BA1\u7535\u538B\u6709\u65AD\u76F8\u73B0\u8C61"
|
Before Width: | Height: | Size: 602 KiB After Width: | Height: | Size: 602 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -845,7 +845,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 7
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &214298342
|
||||
GameObject:
|
||||
|
@ -2605,7 +2605,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &333646758
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -4517,7 +4517,7 @@ PrefabInstance:
|
|||
m_Modifications:
|
||||
- target: {fileID: 3350233854110697392, guid: 5a7d7e9bd76f93b418b1f916781feb6a, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 8
|
||||
value: 7
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3350233854110697392, guid: 5a7d7e9bd76f93b418b1f916781feb6a, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
@ -5221,7 +5221,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!65 &1265359517
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -5231,7 +5231,7 @@ BoxCollider:
|
|||
m_GameObject: {fileID: 1265359516}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
|
@ -5293,12 +5293,13 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1265359516}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -5.8120117, y: -0.97698975, z: -0.49}
|
||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_LocalPosition: {x: -6.138, y: -0.97698975, z: -0.49}
|
||||
m_LocalScale: {x: 1.7114836, y: 0.882692, z: 1.3039875}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2059769794}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_RootOrder: 8
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1265359521
|
||||
MonoBehaviour:
|
||||
|
@ -5307,7 +5308,7 @@ MonoBehaviour:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1265359516}
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
|
@ -5369,19 +5370,13 @@ MonoBehaviour:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1265359516}
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 936e1a57cc0a2944a89d7b1617875726, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
"\u7269\u54C1\u540D\u79F0":
|
||||
"\u7269\u54C1\u5206\u7C7B": 3
|
||||
"\u7269\u54C1\u72B6\u6001": 2
|
||||
"\u4EA4\u4E92\u5B8C\u6210": 0
|
||||
inHandPos: {x: 0, y: 0, z: 0}
|
||||
inHandRot: {x: 0, y: 0, z: 0}
|
||||
game: {fileID: 333646762}
|
||||
name:
|
||||
name: Computer
|
||||
--- !u!1001 &1266954248
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -7474,23 +7469,35 @@ PrefabInstance:
|
|||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_TransformParent: {fileID: 1265359520}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 9
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.76687855
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.132898
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 0.58428836
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -6.153
|
||||
value: -0.008764247
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -1.505
|
||||
value: -0.5981817
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -0.498
|
||||
value: -0.006135018
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
|
@ -7550,6 +7557,11 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
--- !u!4 &2059769794 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 483e16a8ce5cebd47a3a743327bb5993, type: 3}
|
||||
m_PrefabInstance: {fileID: 2059769793}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &2067175759
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8164,16 +8176,28 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5863485535301246023, guid: 9d013d05025dab8428d976610feb0b7d, type: 3}
|
||||
propertyPath: newWindowAction
|
||||
value: 0
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5863485535301246023, guid: 9d013d05025dab8428d976610feb0b7d, type: 3}
|
||||
propertyPath: allowContextMenuOn
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5863485535498290377, guid: 9d013d05025dab8428d976610feb0b7d, type: 3}
|
||||
propertyPath: m_Color.a
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5863485535498290377, guid: 9d013d05025dab8428d976610feb0b7d, type: 3}
|
||||
propertyPath: m_Texture
|
||||
value:
|
||||
objectReference: {fileID: 0}
|
||||
objectReference: {fileID: 2800000, guid: 30a28a853ae87d44bab2c4bdc861c40d, type: 3}
|
||||
- target: {fileID: 5863485535498290381, guid: 9d013d05025dab8428d976610feb0b7d, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: BrowserGUI
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5863485535498290381, guid: 9d013d05025dab8428d976610feb0b7d, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 9d013d05025dab8428d976610feb0b7d, type: 3}
|
||||
--- !u!114 &1374127874211543268 stripped
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f2f2317e83ddf642b3f96db49847598
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,162 @@
|
|||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class CameraControl : MonoBehaviour
|
||||
{
|
||||
public static CameraControl Instance { private set; get; }
|
||||
public float minDis = 0.5f;
|
||||
public float maxDis = 1.5f;
|
||||
public float rSmoothTime = 0.3f, sSmoothTime = 0.3f, mSmoothTime = 0.3f;
|
||||
public float mouseRotSpeed = 8, mouseMoveSpeed = 1, mouseZoomSpeed = 15;
|
||||
public float minVerticalAngle = -30, maxVerticalAngle = 60;
|
||||
public float minHorizontalAngle = -60, maxHorizontalAngle = 60;
|
||||
[Header("初始化数据"), SerializeField] float orginDis = 0;
|
||||
Vector3 currentPosition, movVelocity, targetPosition;
|
||||
float targetDis, currentDis, disVelocity;
|
||||
Vector3 currentRotation, targetRotation, rotVelocity;
|
||||
[SerializeField] Transform target;
|
||||
Vector3 pos;
|
||||
bool isok = false;
|
||||
public bool ZhoLI = false;//是否是重力模式
|
||||
float speed = 20;
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
SetCameraTrans();
|
||||
//Debug.Log("CameraControl");
|
||||
}
|
||||
[ContextMenu("设置相机位置")]
|
||||
private void SetCameraTrans()
|
||||
{
|
||||
currentDis = targetDis = orginDis;
|
||||
currentPosition = targetPosition = transform.position;
|
||||
currentRotation = targetRotation = transform.localEulerAngles;
|
||||
}
|
||||
public void SetOrginDis(Vector3 orginPos, Vector3 orginRO)
|
||||
{
|
||||
target = null;
|
||||
targetPosition = orginPos;
|
||||
targetRotation = orginRO;
|
||||
targetDis = 0;
|
||||
}
|
||||
public void SetPos(Vector3 pos,Vector3 ro)
|
||||
{
|
||||
targetPosition = pos;
|
||||
targetRotation = ro;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (Input.touchCount == 0 && Input.GetMouseButton(1))
|
||||
{
|
||||
targetRotation.y += Input.GetAxis("Mouse X") * mouseRotSpeed;
|
||||
targetRotation.x -= Input.GetAxis("Mouse Y") * mouseRotSpeed;
|
||||
}
|
||||
targetDis = targetDis - Input.GetAxis("Mouse ScrollWheel") * mouseZoomSpeed;
|
||||
targetRotation.x = Mathf.Clamp(targetRotation.x, minVerticalAngle, maxVerticalAngle);
|
||||
//targetRotation.y = Mathf.Clamp(targetRotation.y, minHorizontalAngle, maxHorizontalAngle);
|
||||
targetDis = Mathf.Clamp(targetDis, minDis, maxDis);
|
||||
currentDis = Mathf.SmoothDamp(currentDis, targetDis, ref disVelocity, rSmoothTime);
|
||||
currentRotation = Vector3.SmoothDamp(currentRotation, targetRotation, ref rotVelocity, rSmoothTime);
|
||||
var tmpRotation = Quaternion.Euler(currentRotation);
|
||||
var offset = tmpRotation * Vector3.forward * -currentDis;
|
||||
if (target != null)
|
||||
{
|
||||
targetPosition = target.position;
|
||||
}
|
||||
currentPosition = Vector3.SmoothDamp(currentPosition, targetPosition, ref movVelocity, mSmoothTime);
|
||||
var tmpPosition = currentPosition + offset;
|
||||
if (transform.rotation != tmpRotation)
|
||||
{
|
||||
transform.rotation=tmpRotation;
|
||||
}
|
||||
if (ZhoLI)
|
||||
{
|
||||
if (transform.position.y > 3f)
|
||||
{
|
||||
transform.position = new Vector3(transform.position.x, 2.1f, transform.position.z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (transform.position.y > 20f)
|
||||
{
|
||||
transform.position = new Vector3(transform.position.x, 20f, transform.position.z);
|
||||
}
|
||||
}
|
||||
if (transform.position.y < 2f)
|
||||
{
|
||||
transform.position = new Vector3(transform.position.x, 2.1f, transform.position.z);
|
||||
}
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
{
|
||||
speed = 25f;
|
||||
}
|
||||
else
|
||||
{
|
||||
speed = 12f;
|
||||
}
|
||||
|
||||
|
||||
float x= Mathf.Clamp(transform.position.x, -137f, 102f);
|
||||
//float y = Mathf.Clamp(transform.position.y, 2.1f, 20f);
|
||||
float z= Mathf.Clamp(transform.position.z, -125f, 119f);
|
||||
transform.position = new Vector3(x,transform.position.y,z);
|
||||
}
|
||||
private void FixedUpdate()
|
||||
{
|
||||
float x = Input.GetAxis("Horizontal");
|
||||
float y = Input.GetAxis("Vertical");
|
||||
float z = Input.GetAxis("Updown");
|
||||
if (x != 0 || y != 0 || z != 0)
|
||||
{
|
||||
Debug.Log("Horizontal " + x + " Ver" + y);
|
||||
if (!ZhoLI)
|
||||
{
|
||||
z = (z * Time.deltaTime * speed);
|
||||
Debug.Log(z);
|
||||
}
|
||||
pos = new Vector3(x * Time.deltaTime * speed, z, y * Time.deltaTime * speed);
|
||||
isok = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
isok = false;
|
||||
}
|
||||
if (isok)
|
||||
{
|
||||
if (transform.position != pos || x != 0 || y != 0||z !=0)
|
||||
{
|
||||
transform.Translate(pos);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//public void Fly()
|
||||
//{
|
||||
// ZhoLI = false;
|
||||
// transform.GetComponent<Rigidbody>().useGravity = false;
|
||||
// transform.position = new Vector3(transform.position.x, 20f, transform.position.z);
|
||||
//}
|
||||
//public void NotFly()
|
||||
//{
|
||||
// ZhoLI = true;
|
||||
// transform.GetComponent<Rigidbody>().useGravity = true;
|
||||
// transform.position = new Vector3(transform.position.x,2.1f,transform.position.z);
|
||||
//}
|
||||
}
|
||||
////声明部分public float horizontalinput;
|
||||
/////水平参数public float Verticalinput;
|
||||
/////垂直参数float speed=10.0f;
|
||||
/////声明一个参数,没有规定
|
||||
/////在update中书写
|
||||
///void Update()
|
||||
///{
|
||||
///horizontalinput = Input.GetAxis("Horizontal");
|
||||
/////AD方向控制Verticalinput = Input.GetAxis("Vertical");
|
||||
///if (horizontalinput!=0&&Verticalinput!=0)
|
||||
///{horizontalinput = horizontalinput * 0.6f;Verticalinput = Verticalinput * 0.6f;}
|
||||
/////WS方向控制this.transform.Translate(Vector3.right * horizontalinput * Time.deltaTime * speed);
|
||||
///控制该物体向侧方移动this.transform.Translate(Vector3.forward* Verticalinput * Time.deltaTime * speed);//控制该物体向前后移动}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 03962d1a310647749949f007b0d3edb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,176 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
|
||||
public class CameraControl1 : MonoBehaviour
|
||||
{
|
||||
|
||||
public static CameraControl1 ins;
|
||||
[Header("设置参数")]
|
||||
[SerializeField] float minDis = 2;
|
||||
[SerializeField] float maxDis ;
|
||||
[SerializeField] float mouseRotSpeed = 8;
|
||||
[SerializeField] float touchZoomSpeed = 0.1f;
|
||||
[SerializeField] float touchRotateSpeed = 0.3f;
|
||||
[SerializeField] float mouseMoveSpeed = 1;
|
||||
[SerializeField] float mouseZoomSpeed = 10;
|
||||
[SerializeField] float rSmoothTime = 0.3f;
|
||||
[SerializeField] float sSmoothTime = 0.3f;
|
||||
[SerializeField] float mSmoothTime = 0.3f;
|
||||
[SerializeField] float minVerticalAngle = 0;
|
||||
[SerializeField] float maxVerticalAngle = 60;
|
||||
[Header("用于展示数据")]
|
||||
[SerializeField] float horizontalAngle = 0;
|
||||
[SerializeField] float verticalAngle = 0;
|
||||
[SerializeField] float currentDis = 80;
|
||||
[SerializeField] Vector3 originPosition;
|
||||
[SerializeField] Vector3 targetPosition;
|
||||
//[HideInInspector] public bool isrotateend;
|
||||
bool isrotateable;
|
||||
bool isscaleable;
|
||||
float _targetDis;
|
||||
private Touch oldTouch1;
|
||||
private Touch oldTouch2;
|
||||
//
|
||||
public bool UPDOWN = false;
|
||||
|
||||
|
||||
float targetDis
|
||||
{
|
||||
set
|
||||
{
|
||||
_targetDis = value > maxDis ? maxDis : value < minDis ? minDis : value;
|
||||
}
|
||||
get { return _targetDis; }
|
||||
}
|
||||
Vector3 rVelocity = Vector3.zero;
|
||||
float sVelocity = 0;
|
||||
Vector3 mVelocity = Vector3.zero;
|
||||
Vector3 dampRotation;
|
||||
Transform targetTrans;
|
||||
bool m_IsSingleFinger;
|
||||
private void Awake()
|
||||
{
|
||||
ins = this;
|
||||
targetDis = currentDis;
|
||||
targetPosition = originPosition;
|
||||
}
|
||||
|
||||
[ContextMenu("设置相机位置")]
|
||||
private void SetCameraTrans()
|
||||
{
|
||||
transform.eulerAngles = new Vector3(verticalAngle, horizontalAngle, 0);
|
||||
var offset = transform.forward * -currentDis;
|
||||
transform.position = originPosition + offset;
|
||||
}
|
||||
public void SetTarget(Transform target, float distance = 4)
|
||||
{
|
||||
targetDis = distance;
|
||||
targetTrans = target;
|
||||
}
|
||||
public void SetCenterPoint(Vector3 target, float distance = 4)
|
||||
{
|
||||
targetDis = distance;
|
||||
targetPosition = target;
|
||||
}
|
||||
public void Recover(float max, float min)
|
||||
{
|
||||
|
||||
// targetPosition = originPosition = Vector3.zero;
|
||||
horizontalAngle -= horizontalAngle % 360;
|
||||
verticalAngle = 0;
|
||||
maxDis = max;
|
||||
minDis = min;
|
||||
targetDis = maxDis;
|
||||
// targetTrans = null;
|
||||
}
|
||||
public void RecoverTwo()
|
||||
{
|
||||
horizontalAngle -= horizontalAngle % 360;
|
||||
verticalAngle = 0;
|
||||
targetDis = maxDis;
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//限制视角上下
|
||||
if (UPDOWN)
|
||||
{
|
||||
if (verticalAngle < -15)
|
||||
{
|
||||
verticalAngle = -15;
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.touchCount == 0)
|
||||
{
|
||||
// isscaleable = true;
|
||||
isrotateable = true;
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
horizontalAngle += Input.GetAxis("Mouse X") * mouseRotSpeed;
|
||||
verticalAngle -= Input.GetAxis("Mouse Y") * mouseRotSpeed;
|
||||
|
||||
verticalAngle = Mathf.Clamp(verticalAngle, minVerticalAngle, maxVerticalAngle);
|
||||
}
|
||||
targetDis = targetDis - Input.GetAxis("Mouse ScrollWheel") * mouseZoomSpeed;
|
||||
}
|
||||
|
||||
if (Input.touchCount == 1)
|
||||
{
|
||||
if (isrotateable)
|
||||
{
|
||||
if (Input.touches[0].phase == TouchPhase.Began)
|
||||
{
|
||||
oldTouch1 = Input.touches[0];
|
||||
}
|
||||
var deltaPos = Input.touches[0].position - oldTouch1.position;
|
||||
horizontalAngle += deltaPos.x * touchRotateSpeed*3f ;
|
||||
verticalAngle -= deltaPos.y * touchRotateSpeed;
|
||||
verticalAngle = Mathf.Clamp(verticalAngle, minVerticalAngle, maxVerticalAngle);
|
||||
oldTouch1 = Input.touches[0];
|
||||
}
|
||||
}
|
||||
if (Input.touchCount == 2)
|
||||
{
|
||||
isrotateable = false ;
|
||||
if (Input.touches[1].phase == TouchPhase.Began)
|
||||
{
|
||||
oldTouch1 = Input.touches[0];
|
||||
oldTouch2 = Input.touches[1];
|
||||
}
|
||||
float currentTouchDistance = Vector2.Distance(Input.touches[0].position, Input.touches[1].position);
|
||||
float lastTouchDistance = Vector2.Distance(oldTouch1.position, oldTouch2.position);
|
||||
if (Input.touches[0].phase != TouchPhase.Ended && Input.touches[1].phase != TouchPhase.Ended)
|
||||
{
|
||||
//计算上次和这次双指触摸之间的距离差距
|
||||
//然后去更改摄像机的距离
|
||||
targetDis -= (currentTouchDistance - lastTouchDistance) * touchZoomSpeed;
|
||||
oldTouch1 = Input.touches[0];
|
||||
oldTouch2 = Input.touches[1];
|
||||
}
|
||||
}
|
||||
|
||||
currentDis = Mathf.SmoothDamp(currentDis, targetDis, ref sVelocity, rSmoothTime);
|
||||
dampRotation = Vector3.SmoothDamp(dampRotation, new Vector3(verticalAngle, horizontalAngle), ref rVelocity, rSmoothTime);
|
||||
transform.rotation = Quaternion.Euler(dampRotation);
|
||||
if (targetTrans != null)
|
||||
{
|
||||
if (originPosition != targetTrans.position)
|
||||
originPosition = Vector3.SmoothDamp(originPosition, targetTrans.position, ref mVelocity, mSmoothTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (originPosition != targetPosition)
|
||||
originPosition = Vector3.SmoothDamp(originPosition, targetPosition, ref mVelocity, mSmoothTime);
|
||||
}
|
||||
var offset = transform.forward * -currentDis;
|
||||
transform.position = originPosition + offset;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5eb279537374e4e4d8f1ad4cf74d2b06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,18 +1,28 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
public static GameManager ins;
|
||||
public GameObject Player;
|
||||
public CameraManager CameraManager;
|
||||
List<GameObject> tools;
|
||||
[SerializeField] GameObject g1;
|
||||
char[] g2 = new char[7] {'(','C','l','o','n','e',')' };
|
||||
public void Awake()
|
||||
[SerializeField] GameObject QianXing;
|
||||
[SerializeField] GameObject WanYon;
|
||||
[SerializeField] GameObject YanDianBi;
|
||||
char[] TempChar = new char[7] {'(','C','l','o','n','e',')' };
|
||||
public string dataStr;
|
||||
[SerializeField] List<datas> Datas= new List<datas>();
|
||||
[SerializeField] List<GameObject> GFGame;//光伏板物体
|
||||
[SerializeField] SceneData SceneData;//暂时数据
|
||||
[SerializeField] List<GameObject> Inverter;
|
||||
public void AwakeAsync()
|
||||
{
|
||||
if (ins!=null)
|
||||
{
|
||||
|
@ -20,22 +30,78 @@ public class GameManager : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
ins = this;
|
||||
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
async void Start()
|
||||
{
|
||||
ToolsShow(g1);
|
||||
await initAsync();
|
||||
for (int i = 0; i < SceneData.GFData; i++)
|
||||
{
|
||||
GFGame[i].gameObject.SetActive(true);
|
||||
}
|
||||
for (int i = 0; i < SceneData.inverterSum; i++)
|
||||
{
|
||||
Inverter[i].gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
async Task initAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
Datas.Add(await HttpTool.GetJsonAsync<datas>($"http://111.229.30.246:10013/Handler/Taiqu.ashx?action=changjing&bianhao={dataStr}"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError(ex.Message);
|
||||
}
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.Q))
|
||||
{
|
||||
ToolsShow(QianXing);
|
||||
}
|
||||
//if(Input.GetKeyDown(KeyCode.W))
|
||||
//{
|
||||
// ToolsShow(WanYon);
|
||||
//}
|
||||
if(Input.GetKeyDown(KeyCode.E))
|
||||
{
|
||||
ToolsShow(YanDianBi);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// ¹¤¾ßÉú³É·½·¨
|
||||
/// </summary>
|
||||
public void ToolsShow(GameObject tools)
|
||||
{
|
||||
GameObject temp = Instantiate(tools);
|
||||
string name = Filter(temp.name,g2);
|
||||
GameObject temp = Instantiate(tools, Player.transform);
|
||||
temp.transform.localPosition = new Vector3(0.319f,-0.471f,0.87f);
|
||||
temp.transform.localRotation = Quaternion.Euler(new Vector3(90,180,0));
|
||||
temp.AddComponent<ClampAmmeters>();
|
||||
string name = Filter(temp.name,TempChar);
|
||||
Debug.Log(name);
|
||||
switch (temp.name)
|
||||
switch (name)
|
||||
{
|
||||
case "万用表":
|
||||
break;
|
||||
case "钳形电流表":
|
||||
ToolModelClick tool = temp.GetComponent<ToolModelClick>();
|
||||
ClampAmmeters clamp = temp.GetComponent<ClampAmmeters>();
|
||||
//tool.onDown.AddListener(clamp.MouseDown);
|
||||
tool.onDrag.AddListener(() =>
|
||||
{
|
||||
clamp.isok = true;
|
||||
});
|
||||
tool.onExit.AddListener(() =>
|
||||
{
|
||||
clamp.isok = false;
|
||||
});
|
||||
|
||||
break;
|
||||
case "":
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -46,3 +112,20 @@ public class GameManager : MonoBehaviour
|
|||
return String.Concat(str.Split(charsToRemove.ToArray()));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 后台读的数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class datas
|
||||
{
|
||||
public bool state;
|
||||
public string message;
|
||||
public data2s data;
|
||||
}
|
||||
[Serializable]
|
||||
public class data2s
|
||||
{
|
||||
public string isguangfu;
|
||||
public string jxfs;
|
||||
public string zhbl;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
using Cysharp.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class HttpTool
|
||||
{
|
||||
/// <summary>
|
||||
/// get
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="uri"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<T> GetJsonAsync<T>(string uri)
|
||||
{
|
||||
Debug.Log("akjsbd");
|
||||
using (var uwr = UnityWebRequest.Get(uri))
|
||||
{
|
||||
await uwr.SendWebRequest();
|
||||
if (uwr.isNetworkError)
|
||||
{
|
||||
Debug.LogError(uwr.error);
|
||||
return default(T);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(JsonUtility.FromJson<T>(uwr.downloadHandler.text));
|
||||
return JsonUtility.FromJson<T>(uwr.downloadHandler.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//if (uwr.result == UnityWebRequest.Result.Success)
|
||||
// return JsonUtility.FromJson<T>(uwr.downloadHandler.text);
|
||||
//else
|
||||
//{
|
||||
// Debug.LogError(uwr.error);
|
||||
// return default(T);
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// Post±íµ¥
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="uri"></param>
|
||||
/// <param name="keyValuePairs"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<T> PostFromAsync<T>(string uri, Dictionary<string, string> keyValuePairs)
|
||||
{
|
||||
WWWForm formData = new WWWForm();
|
||||
foreach (var item in keyValuePairs)
|
||||
{
|
||||
formData.AddField(item.Key, item.Value);
|
||||
}
|
||||
using (var uwr = UnityWebRequest.Post(uri, formData))
|
||||
{
|
||||
await uwr.SendWebRequest();
|
||||
if (uwr.isNetworkError)
|
||||
{
|
||||
Debug.LogError(uwr.error);
|
||||
return default(T);
|
||||
}
|
||||
else
|
||||
return JsonUtility.FromJson<T>(uwr.downloadHandler.text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// PostJson
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="uri"></param>
|
||||
/// <param name="jsonObject"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<T> PostJsonAysnc<T>(string uri, object jsonObject)
|
||||
{
|
||||
var jsonString = JsonUtility.ToJson(jsonObject);
|
||||
// Debug.Log(jsonString);
|
||||
var postData = System.Text.Encoding.Default.GetBytes(jsonString);
|
||||
using (var uwr = new UnityWebRequest(uri, "POST"))
|
||||
{
|
||||
uwr.SetRequestHeader("Content-type", "application/json");
|
||||
uwr.uploadHandler = new UploadHandlerRaw(postData);
|
||||
uwr.downloadHandler = new DownloadHandlerBuffer();
|
||||
await uwr.SendWebRequest();
|
||||
if (uwr.isNetworkError)
|
||||
{
|
||||
Debug.LogError(uwr.error);
|
||||
return default(T);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.Log(uwr.downloadHandler.text+"£º·¢Ë͵½£º"+uwr );
|
||||
return JsonUtility.FromJson<T>(uwr.downloadHandler.text);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dd4f45ed7bc2b4e4698d826bc4b7760c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -37,6 +37,8 @@ public class LoaclInterObjectWatch : MonoBehaviour
|
|||
onClick();
|
||||
|
||||
};
|
||||
|
||||
//onClick();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ToolsMove : MonoBehaviour
|
||||
{
|
||||
ToolModelClick toolModelClick;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//Debug.Log("dada");
|
||||
//toolModelClick.enter.AddListener(EnterTTT);
|
||||
}
|
||||
|
||||
public void EnterTTT()
|
||||
{
|
||||
Debug.Log("OnMouseEnter");
|
||||
}
|
||||
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
Debug.Log(transform.name);
|
||||
}
|
||||
private void OnMouseDrag()
|
||||
{
|
||||
Debug.Log(transform.name);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f833184ffe9580645a0630d2857ac1b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
using ZenFulcrum.EmbeddedBrowser;
|
||||
|
||||
public class newfollow : ToolBase
|
||||
public class newfollow : MonoBehaviour
|
||||
{
|
||||
[SerializeField] testURL game;
|
||||
[SerializeField] string name;
|
||||
|
@ -34,8 +34,8 @@ public class newfollow : ToolBase
|
|||
if (hit.transform.name.Equals(name))
|
||||
{
|
||||
Debug.Log(hit.transform.name);
|
||||
game.init("baidu.com");
|
||||
game.gameObject.SetActive(true);
|
||||
game.init("https://blog.csdn.net/qq_42481369/article/details/114674590");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ public class testURL : MonoBehaviour
|
|||
[SerializeField] Browser browser;
|
||||
public void init(string urls)
|
||||
{
|
||||
browser.Url = urls;
|
||||
browser.gameObject.SetActive(true);
|
||||
browser.Url = urls;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ using System;
|
|||
/// Version: 1.0 alpha 1
|
||||
///
|
||||
/// - Use "ToAudioClip" method for loading wav file / bytes.
|
||||
/// Loads .wav (PCM uncompressed) files at 8,16,24 and 32 bits and converts data to Unity's AudioClip.
|
||||
/// Loads .wav (PCM uncompressed) files at 8,16,24 and 32 bits and converts datas to Unity's AudioClip.
|
||||
///
|
||||
/// - Use "FromAudioClip" method for saving wav file / bytes.
|
||||
/// Converts an AudioClip's float data into wav byte array at 16 bit.
|
||||
/// Converts an AudioClip's float datas into wav byte array at 16 bit.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For documentation and usage examples: https://github.com/deadlyfingers/UnityWav
|
||||
|
@ -23,7 +23,7 @@ public class WavTool
|
|||
const int BlockSize_16Bit = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Load PCM format *.wav audio file (using Unity's Application data path) and convert to AudioClip.
|
||||
/// Load PCM format *.wav audio file (using Unity's Application datas path) and convert to AudioClip.
|
||||
/// </summary>
|
||||
/// <returns>The AudioClip.</returns>
|
||||
/// <param name="filePath">Local file path to .wav file</param>
|
||||
|
@ -31,7 +31,7 @@ public class WavTool
|
|||
{
|
||||
if (!filePath.StartsWith(Application.persistentDataPath) && !filePath.StartsWith(Application.dataPath))
|
||||
{
|
||||
Debug.LogWarning("This only supports files that are stored using Unity's Application data path. \nTo load bundled resources use 'Resources.Load(\"filename\") typeof(AudioClip)' method. \nhttps://docs.unity3d.com/ScriptReference/Resources.Load.html");
|
||||
Debug.LogWarning("This only supports files that are stored using Unity's Application datas path. \nTo load bundled resources use 'Resources.Load(\"filename\") typeof(AudioClip)' method. \nhttps://docs.unity3d.com/ScriptReference/Resources.Load.html");
|
||||
return null;
|
||||
}
|
||||
byte[] fileBytes = File.ReadAllBytes(filePath);
|
||||
|
@ -89,7 +89,7 @@ public class WavTool
|
|||
{
|
||||
int wavSize = BitConverter.ToInt32(source, headerOffset);
|
||||
headerOffset += sizeof(int);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 8-bit wav size: {0} from data bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 8-bit wav size: {0} from datas bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
|
||||
float[] data = new float[wavSize];
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class WavTool
|
|||
{
|
||||
int wavSize = BitConverter.ToInt32(source, headerOffset);
|
||||
headerOffset += sizeof(int);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 16-bit wav size: {0} from data bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 16-bit wav size: {0} from datas bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
|
||||
int x = sizeof(Int16); // block size = 2
|
||||
int convertedSize = wavSize / x;
|
||||
|
@ -127,7 +127,7 @@ public class WavTool
|
|||
++i;
|
||||
}
|
||||
|
||||
Debug.AssertFormat(data.Length == convertedSize, "AudioClip .wav data is wrong size: {0} == {1}", data.Length, convertedSize);
|
||||
Debug.AssertFormat(data.Length == convertedSize, "AudioClip .wav datas is wrong size: {0} == {1}", data.Length, convertedSize);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class WavTool
|
|||
{
|
||||
int wavSize = BitConverter.ToInt32(source, headerOffset);
|
||||
headerOffset += sizeof(int);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 24-bit wav size: {0} from data bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 24-bit wav size: {0} from datas bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
|
||||
int x = 3; // block size = 3
|
||||
int convertedSize = wavSize / x;
|
||||
|
@ -157,7 +157,7 @@ public class WavTool
|
|||
++i;
|
||||
}
|
||||
|
||||
Debug.AssertFormat(data.Length == convertedSize, "AudioClip .wav data is wrong size: {0} == {1}", data.Length, convertedSize);
|
||||
Debug.AssertFormat(data.Length == convertedSize, "AudioClip .wav datas is wrong size: {0} == {1}", data.Length, convertedSize);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class WavTool
|
|||
{
|
||||
int wavSize = BitConverter.ToInt32(source, headerOffset);
|
||||
headerOffset += sizeof(int);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 32-bit wav size: {0} from data bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 32-bit wav size: {0} from datas bytes: {1} at offset: {2}", wavSize, dataSize, headerOffset);
|
||||
|
||||
int x = sizeof(float); // block size = 4
|
||||
int convertedSize = wavSize / x;
|
||||
|
@ -184,7 +184,7 @@ public class WavTool
|
|||
++i;
|
||||
}
|
||||
|
||||
Debug.AssertFormat(data.Length == convertedSize, "AudioClip .wav data is wrong size: {0} == {1}", data.Length, convertedSize);
|
||||
Debug.AssertFormat(data.Length == convertedSize, "AudioClip .wav datas is wrong size: {0} == {1}", data.Length, convertedSize);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class WavTool
|
|||
UInt16 bitDepth = 16; //BitDepth (audioClip);
|
||||
|
||||
// NB: Only supports 16 bit
|
||||
//Debug.AssertFormat (bitDepth == 16, "Only converting 16 bit is currently supported. The audio clip data is {0} bit.", bitDepth);
|
||||
//Debug.AssertFormat (bitDepth == 16, "Only converting 16 bit is currently supported. The audio clip datas is {0} bit.", bitDepth);
|
||||
|
||||
// total file size = 44 bytes for header format and audioClip.samples * factor due to float to Int16 / sbyte conversion
|
||||
int fileSize = audioClip.samples * BlockSize_16Bit + headerSize; // BlockSize (bitDepth)
|
||||
|
@ -216,7 +216,7 @@ public class WavTool
|
|||
WriteFileHeader(ref stream, fileSize);
|
||||
// file header (fmt)
|
||||
WriteFileFormat(ref stream, audioClip.channels, audioClip.frequency, bitDepth);
|
||||
// data chunks (data)
|
||||
// datas chunks (datas)
|
||||
WriteFileData(ref stream, audioClip, bitDepth);
|
||||
|
||||
byte[] bytes = stream.ToArray();
|
||||
|
@ -304,25 +304,25 @@ public class WavTool
|
|||
int count = 0;
|
||||
int total = 8;
|
||||
|
||||
// Copy float[] data from AudioClip
|
||||
// Copy float[] datas from AudioClip
|
||||
float[] data = new float[audioClip.samples * audioClip.channels];
|
||||
audioClip.GetData(data, 0);
|
||||
|
||||
byte[] bytes = ConvertAudioClipDataToInt16ByteArray(data);
|
||||
|
||||
byte[] id = Encoding.ASCII.GetBytes("data");
|
||||
byte[] id = Encoding.ASCII.GetBytes("datas");
|
||||
count += WriteBytesToMemoryStream(ref stream, id, "DATA_ID");
|
||||
|
||||
int subchunk2Size = Convert.ToInt32(audioClip.samples * BlockSize_16Bit); // BlockSize (bitDepth)
|
||||
count += WriteBytesToMemoryStream(ref stream, BitConverter.GetBytes(subchunk2Size), "SAMPLES");
|
||||
|
||||
// Validate header
|
||||
Debug.AssertFormat(count == total, "Unexpected wav data id byte count: {0} == {1}", count, total);
|
||||
Debug.AssertFormat(count == total, "Unexpected wav datas id byte count: {0} == {1}", count, total);
|
||||
|
||||
// Write bytes to stream
|
||||
count += WriteBytesToMemoryStream(ref stream, bytes, "DATA");
|
||||
|
||||
// Validate audio data
|
||||
// Validate audio datas
|
||||
Debug.AssertFormat(bytes.Length == subchunk2Size, "Unexpected AudioClip to wav subchunk2 size: {0} == {1}", bytes.Length, subchunk2Size);
|
||||
|
||||
return count;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: af0cb5cf014e6284692f1826af15c057
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,39 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// ǯÐÎǯÐεçÁ÷±í
|
||||
/// </summary>
|
||||
public class ClampAmmeters : MonoBehaviour
|
||||
{
|
||||
//private Vector3 offset;
|
||||
//public void MouseDown()
|
||||
//{
|
||||
// offset = GetMouseWorldPos();
|
||||
//}
|
||||
Vector3 pos;
|
||||
public bool isok = false;
|
||||
public void MouseDrag()
|
||||
{
|
||||
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hitInfo;
|
||||
|
||||
if (Physics.Raycast(ray, out hitInfo))
|
||||
{
|
||||
if (pos!= hitInfo.point)
|
||||
{
|
||||
transform.GetComponent<BoxCollider>().isTrigger= true;
|
||||
transform.position = hitInfo.point;
|
||||
pos = hitInfo.point;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b36d48c576bc3ff48a2626d3e0b2bd76
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: be8f397fe039a2c439fa6f298560bdd4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,17 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SceneData : MonoBehaviour
|
||||
{
|
||||
[SerializeField] int OperatingCapacity;//运行容量
|
||||
[SerializeField] int FixedValue = 295;//固定容量
|
||||
public int GFData;//光伏板数量=运行容量/固定容量,取int值
|
||||
public int inverterSum = 2;
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
//Global
|
||||
GFData = OperatingCapacity / FixedValue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7d6add50eadc99948962f0eb8a109a41
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue