添加暂存功能。
This commit is contained in:
parent
ddb9745cbb
commit
d5e4af1077
|
@ -0,0 +1,183 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1697577626625020879
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5126483381027065934}
|
||||||
|
- component: {fileID: 3259257854503564230}
|
||||||
|
m_Layer: 11
|
||||||
|
m_Name: Cube
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &5126483381027065934
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1697577626625020879}
|
||||||
|
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||||
|
m_LocalPosition: {x: 0.25062847, y: 0.011602521, z: 0.12357366}
|
||||||
|
m_LocalScale: {x: 0.0109440535, y: 0.020276764, z: 0.014573432}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 7369007019552362491}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!65 &3259257854503564230
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1697577626625020879}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1.0000005, z: 1.0000005}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &7577969903643560578
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3517757055847926803}
|
||||||
|
m_Layer: 8
|
||||||
|
m_Name: "\u951A\u70B9"
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3517757055847926803
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7577969903643560578}
|
||||||
|
m_LocalRotation: {x: 0.7071068, y: -0, z: 0, w: 0.7071068}
|
||||||
|
m_LocalPosition: {x: 0, y: -0.3, z: -0.26637805}
|
||||||
|
m_LocalScale: {x: 1, y: 0.99999976, z: 0.99999976}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 7369007019552362491}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &7856574062610814273
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7369007019552362491}
|
||||||
|
- component: {fileID: 5903131978853007454}
|
||||||
|
- component: {fileID: 8505281043754431636}
|
||||||
|
- component: {fileID: -3822767481014288823}
|
||||||
|
m_Layer: 8
|
||||||
|
m_Name: 17 1
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &7369007019552362491
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7856574062610814273}
|
||||||
|
m_LocalRotation: {x: -0.5, y: 0.5, z: 0.5, w: 0.5}
|
||||||
|
m_LocalPosition: {x: -0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 3517757055847926803}
|
||||||
|
- {fileID: 5126483381027065934}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: -90, y: 90, z: 0}
|
||||||
|
--- !u!33 &5903131978853007454
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7856574062610814273}
|
||||||
|
m_Mesh: {fileID: -7553716758358721678, guid: 63978f243412b7a458666a82ac9205f4, type: 3}
|
||||||
|
--- !u!23 &8505281043754431636
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7856574062610814273}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 23930cdbf9df7074e894a234211b32f8, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 75de6e7047697db4cac405e606f3859f, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 3fa0d3a2a06dca64983f7d8a670e12d6, type: 2}
|
||||||
|
- {fileID: 2100000, guid: b47b91fcee225634090b05116b69eea8, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 28399300361a92a45a5952275cf5ef3b, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 105d5674764c77942b59f5a5b090fca6, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 512ec5027c89e554eaf2db7c89d53adf, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!114 &-3822767481014288823
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7856574062610814273}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 6bc0a67b27552c54e893bf2db7023587, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
volume: 6
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ed339a1bd33d8a4479ab52a7d2f01d53
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 519b28b9ae3955b43a1c75d0e355190c
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,95 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &7739985174831531096
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7739985174831531095}
|
||||||
|
- component: {fileID: 7739985174831531092}
|
||||||
|
- component: {fileID: 7739985174831531093}
|
||||||
|
- component: {fileID: 7739985174831531094}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: DragInstruct
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &7739985174831531095
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7739985174831531096}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
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}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 378.8, y: 28.3}
|
||||||
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &7739985174831531092
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7739985174831531096}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &7739985174831531093
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7739985174831531096}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 0}
|
||||||
|
m_Type: 0
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 4
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!114 &7739985174831531094
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7739985174831531096}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8124e469eb4c87f46ad8cb8a995694a6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
oriObjectPrefab: {fileID: 5015601091524974045, guid: 8dc9719f2b7eb2f4ea642a026d7effa9, type: 3}
|
||||||
|
currentUPosItem: {fileID: 0}
|
||||||
|
uPosManger: {fileID: 0}
|
||||||
|
deviceManager: {fileID: 0}
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 070de2f9549561342b884fdf110beaea
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
//============================================================
|
//============================================================
|
||||||
//支持中文,文件使用UTF-8编码
|
//支持中文,文件使用UTF-8编码
|
||||||
//@author #AUTHOR#
|
//@author #AUTHOR#
|
||||||
|
@ -12,15 +13,28 @@ using UnityEngine;
|
||||||
|
|
||||||
public class DeviceItem : MonoBehaviour
|
public class DeviceItem : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public DeviceManager deviceManager;
|
||||||
|
|
||||||
|
public int startIndex;
|
||||||
|
public int volume;
|
||||||
|
public DragTest1 oriPrefab;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
private void Start()
|
public void Init(DeviceManager _deviceManager, int _startIndex, int _volume, DragTest1 _dtPrefab)
|
||||||
{
|
{
|
||||||
|
gameObject.AddComponent<BoxCollider>();
|
||||||
|
deviceManager = _deviceManager;
|
||||||
|
startIndex = _startIndex;
|
||||||
|
volume = _volume;
|
||||||
|
oriPrefab = _dtPrefab;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMouseDown()
|
private void OnMouseDown()
|
||||||
{
|
{
|
||||||
|
if (!EventSystem.current.IsPointerOverGameObject())
|
||||||
|
{
|
||||||
|
Vector3 pos = Input.mousePosition;
|
||||||
|
deviceManager.SetMenuValue(pos, this, oriPrefab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,51 @@ using UnityEngine;
|
||||||
|
|
||||||
public class DeviceManager : MonoBehaviour
|
public class DeviceManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public List<DeviceItem> deviceItems = new List<DeviceItem>();
|
||||||
|
public EditorMenu editorMenu;
|
||||||
|
public RectTransform canvasRect;
|
||||||
|
public DragController dragController;
|
||||||
|
public Transform dragControllerContent;
|
||||||
|
public UPosManger uposManger;
|
||||||
|
public GameObject stagingPanel;
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
editorMenu.gameObject.SetActive(false);
|
||||||
|
SwitchStagingPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetDeviceItem(DeviceItem deviceItem)
|
||||||
|
{
|
||||||
|
deviceItems.Add(deviceItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMenuValue(Vector3 pos, DeviceItem di, DragTest1 dtPrefab)
|
||||||
|
{
|
||||||
|
editorMenu.gameObject.SetActive(true);
|
||||||
|
Vector2 uiLocalPos;
|
||||||
|
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, pos, null, out uiLocalPos);
|
||||||
|
editorMenu.transform.localPosition = uiLocalPos;
|
||||||
|
editorMenu.saveBtn.onClick.RemoveAllListeners();
|
||||||
|
editorMenu.saveBtn.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
DragController dc = Instantiate(dragController, dragControllerContent);
|
||||||
|
dc.oriObjectPrefab = dtPrefab;
|
||||||
|
dc.isSaveMode = true;
|
||||||
|
uposManger.SetCurrentUPosIsOccupied(di.startIndex, di.volume, false);
|
||||||
|
Destroy(di.gameObject);
|
||||||
|
editorMenu.gameObject.SetActive(false);
|
||||||
|
SwitchStagingPanel();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SwitchStagingPanel()
|
||||||
|
{
|
||||||
|
Debug.Log("dragControllerContent.childCount=="+ dragControllerContent.childCount);
|
||||||
|
if (dragControllerContent.childCount > 0)
|
||||||
|
stagingPanel.SetActive(true);
|
||||||
|
else if (dragControllerContent.childCount == 0)
|
||||||
|
stagingPanel.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
|
|
||||||
public DragTest1 oriObjectPrefab;
|
public DragTest1 oriObjectPrefab;
|
||||||
private DragTest1 targetObject;
|
private DragTest1 targetObject;
|
||||||
|
private UPosItem currentUPosItem;
|
||||||
|
|
||||||
public Func<bool> DragCondition;
|
public Func<bool> DragCondition;
|
||||||
public Action<DragTest1> DragAction;
|
public Action<DragTest1> DragAction;
|
||||||
|
@ -27,9 +28,10 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
//public DragTest1 currentDevice;
|
//public DragTest1 currentDevice;
|
||||||
|
|
||||||
|
|
||||||
public UPosItem currentUPosItem;
|
|
||||||
public UPosManger uPosManger;
|
public UPosManger uPosManger;
|
||||||
|
public DeviceManager deviceManager;
|
||||||
|
|
||||||
|
public bool isSaveMode = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,10 +73,6 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
public void OnEndDrag(PointerEventData eventData)
|
public void OnEndDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
EndDragAction?.Invoke(targetObject);
|
EndDragAction?.Invoke(targetObject);
|
||||||
//if (!isOnUPos)
|
|
||||||
//{
|
|
||||||
// Destroy(targetObject.gameObject);
|
|
||||||
//}
|
|
||||||
CountUPos();
|
CountUPos();
|
||||||
currentUPosItem = null;
|
currentUPosItem = null;
|
||||||
targetObject = null;
|
targetObject = null;
|
||||||
|
@ -101,6 +99,13 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
//Debug.Log("index-------------" + index);
|
//Debug.Log("index-------------" + index);
|
||||||
if (!CountUPos(targetObject, index))
|
if (!CountUPos(targetObject, index))
|
||||||
Destroy(targetObject.gameObject);
|
Destroy(targetObject.gameObject);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (isSaveMode)
|
||||||
|
{
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -115,6 +120,10 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
dt.transform.SetParent(uPosManger.uPosItems[index].transform);
|
dt.transform.SetParent(uPosManger.uPosItems[index].transform);
|
||||||
dt.transform.localPosition = new Vector3(0.25f, 0, -0.045f * dt.volume + 0.0225f);
|
dt.transform.localPosition = new Vector3(0.25f, 0, -0.045f * dt.volume + 0.0225f);
|
||||||
uPosManger.SetCurrentUPosIsOccupied(index, dt.volume, true);
|
uPosManger.SetCurrentUPosIsOccupied(index, dt.volume, true);
|
||||||
|
|
||||||
|
DeviceItem di = dt.gameObject.AddComponent<DeviceItem>();
|
||||||
|
di.Init(deviceManager, index, dt.volume, oriObjectPrefab);
|
||||||
|
deviceManager.SetDeviceItem(di);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
//============================================================
|
||||||
|
//支持中文,文件使用UTF-8编码
|
||||||
|
//@author #AUTHOR#
|
||||||
|
//@create #CREATEDATE#
|
||||||
|
//@company #COMPANY#
|
||||||
|
//
|
||||||
|
//@description:编辑模型,删除 编辑 暂存
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
public class EditorMenu : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Button editorBtn;
|
||||||
|
public Button deleteBtn;
|
||||||
|
public Button saveBtn;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 877b36f1b0c742648a8928b66a79342f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -18,6 +18,7 @@ public class UPosManger : MonoBehaviour
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
uPosItems = GetComponentsInChildren<UPosItem>();
|
uPosItems = GetComponentsInChildren<UPosItem>();
|
||||||
|
SetCurrentUPosIsOccupied(0, uPosItems.Length - 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -48,7 +49,7 @@ public class UPosManger : MonoBehaviour
|
||||||
//uPosItems[i].isOccupied = true;
|
//uPosItems[i].isOccupied = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startIndex + count > uPosItems.Length) return -1;
|
if (startIndex + count > uPosItems.Length) return -1;
|
||||||
for (int i = startIndex; i < startIndex + count; i++)
|
for (int i = startIndex; i < startIndex + count; i++)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +66,7 @@ public class UPosManger : MonoBehaviour
|
||||||
{
|
{
|
||||||
//Debug.Log("startIndex-------------" + startIndex);
|
//Debug.Log("startIndex-------------" + startIndex);
|
||||||
//Debug.Log("count-------------" + count);
|
//Debug.Log("count-------------" + count);
|
||||||
for (int i = startIndex; i < startIndex+count; i++)
|
for (int i = startIndex; i < startIndex + count; i++)
|
||||||
{
|
{
|
||||||
uPosItems[i].isOccupied = isEnabel;
|
uPosItems[i].isOccupied = isEnabel;
|
||||||
if (isEnabel)
|
if (isEnabel)
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue