private void OnSelect(ObjectCtrl[] _objectCtrls) { if (((IList <ObjectCtrl>)_objectCtrls).IsNullOrEmpty <ObjectCtrl>()) { this.objectCtrl = (ObjectCtrl)null; this.Visible = false; } else { this.objectCtrl = _objectCtrls.SafeGet <ObjectCtrl>(0); switch (this.objectCtrl.Kind) { case 0: this.itemUI.SetActive(this.OCItem.IsColor1, this.OCItem.IsColor2, this.OCItem.IsColor3, this.OCItem.IsEmissionColor, this.OCItem.IsOption, this.OCItem.IsColor); this.folderUI.Active = false; this.textTitle.set_text("アイテム設定"); this.itemUI.color1.Color = this.OIItem.Color1; this.itemUI.color2.Color = this.OIItem.Color2; this.itemUI.color3.Color = this.OIItem.Color3; this.itemUI.emissionColor.Color = this.OIItem.EmissionColor; this.itemUI.option.IsOn = this.OIItem.VisibleOption; this.Visible = this.itemUI.Active; break; case 1: this.Visible = true; this.itemUI.Active = false; this.folderUI.Active = true; this.textTitle.set_text("フォルダー設定"); this.folderUI.Name = this.OIFolder.Name; break; } } }
private void OnSelect(ObjectCtrl[] _objectCtrls) { ObjectCtrl _objectCtrl = (ObjectCtrl)null; if (!((IList <ObjectCtrl>)_objectCtrls).IsNullOrEmpty <ObjectCtrl>()) { _objectCtrl = ((IEnumerable <ObjectCtrl>)_objectCtrls).FirstOrDefault <ObjectCtrl>((Func <ObjectCtrl, bool>)(_oc => _oc is OCItem)); } this.GuideObject.SetTarget(_objectCtrl); }
public override bool CheckOverlap(ObjectCtrl _oc, bool _load = false) { bool flag = false; foreach (KeyValuePair <IObjectInfo, ObjectCtrl> keyValuePair in this.Child) { flag |= keyValuePair.Value.CheckOverlap(_oc, _load); } return(flag); }
public bool CheckRot(ObjectCtrl _objectCtrl) { Vector3 zero1 = Vector3.get_zero(); Vector3 zero2 = Vector3.get_zero(); _objectCtrl.GetLocalMinMax(_objectCtrl.Position, _objectCtrl.Rotation, this.TransformRoot, ref zero1, ref zero2); Vector3Int vector3Int1; ((Vector3Int) ref vector3Int1).\u002Ector(this.FloorToInt((float)zero1.x), this.FloorToInt((float)zero1.y), this.FloorToInt((float)zero1.z)); Vector3Int vector3Int2; ((Vector3Int) ref vector3Int2).\u002Ector(this.FloorToInt((float)zero2.x), this.FloorToInt((float)zero2.y), this.FloorToInt((float)zero2.z)); Vector3 vector3 = Vector3.op_Multiply(this.GridArea, 0.5f); return(-vector3.x <= (double)((Vector3Int) ref vector3Int1).get_x() && vector3.x >= (double)((Vector3Int) ref vector3Int2).get_x() && 0 <= ((Vector3Int) ref vector3Int1).get_y() && (this.GridArea.y >= (double)((Vector3Int) ref vector3Int2).get_y() && -vector3.z <= (double)((Vector3Int) ref vector3Int1).get_z() && vector3.z >= (double)((Vector3Int) ref vector3Int2).get_z())); }
public void OnInitializePotentialDrag(PointerEventData _eventData) { if (!this.isDragButton) { this.isDragButton = _eventData.get_button() == 0; } this.isDragButton = _eventData.get_button() == 0; if (!this.isDragButton) { return; } this.prevScreenPos = _eventData.get_position(); this.prevPlanePos = this.PlanePos(_eventData.get_position()); this.objectCtrl = this.GuideObject.ObjectCtrl; this.oldRot = this.objectCtrl.LocalEulerAngles; this.workRot = this.oldRot; }
public ObjectCtrl FindOverlapObject(ObjectCtrl _old) { List <ObjectCtrl> _lst = new List <ObjectCtrl>(); foreach (KeyValuePair <IObjectInfo, ObjectCtrl> objectCtrl in this.ObjectCtrls) { if (objectCtrl.Value != null) { objectCtrl.Value.GetOverlapObject(ref _lst); } } if (_lst.IsNullOrEmpty <ObjectCtrl>()) { return((ObjectCtrl)null); } int index = _lst.FindIndex((Predicate <ObjectCtrl>)(v => v == _old)); return(_lst.SafeGet <ObjectCtrl>(GlobalMethod.ValLoop(index + 1, _lst.Count))); }
public bool CorrectPos(ObjectCtrl _objectCtrl, ref Vector3 _pos) { Vector3 zero1 = Vector3.get_zero(); Vector3 zero2 = Vector3.get_zero(); _objectCtrl.GetLocalMinMax(_pos, _objectCtrl.Rotation, this.TransformRoot, ref zero1, ref zero2); Vector3 vector3 = Vector3.op_Multiply(this.GridArea, 0.5f); Vector3 zero3 = Vector3.get_zero(); bool flag = false; if (-vector3.x > zero1.x) { zero3.x = vector3.x + zero1.x; flag = ((flag ? 1 : 0) | 1) != 0; } else if (vector3.x < zero2.x) { zero3.x = zero2.x - vector3.x; flag = ((flag ? 1 : 0) | 1) != 0; } if (0.0 > zero1.y) { zero3.y = zero1.y; flag = ((flag ? 1 : 0) | 1) != 0; } else if (this.GridArea.y < zero2.y) { zero3.y = zero2.y - this.GridArea.y; flag = ((flag ? 1 : 0) | 1) != 0; } if (-vector3.z > zero1.z) { zero3.z = vector3.z + zero1.z; flag = ((flag ? 1 : 0) | 1) != 0; } else if (vector3.z < zero2.z) { zero3.z = zero2.z - vector3.z; flag = ((flag ? 1 : 0) | 1) != 0; } _pos = Vector3.op_Subtraction(_pos, this.TransformRoot.TransformVector(zero3)); return(flag); }
private void Rotation(float _value) { ObjectCtrl selectObject = Singleton <Selection> .Instance.SelectObject; Vector3 localEulerAngles1 = selectObject.LocalEulerAngles; Vector3 localEulerAngles2 = selectObject.LocalEulerAngles; for (int index = 0; index < 3; ++index) { localEulerAngles2.y = (__Null)((localEulerAngles2.y + (double)_value) % 360.0); selectObject.LocalEulerAngles = localEulerAngles2; if (Singleton <GuideManager> .Instance.CheckRot(selectObject)) { Singleton <UndoRedoManager> .Instance.Push((ICommand) new RotationCommand(selectObject, localEulerAngles1)); Singleton <Manager.Housing> .Instance.CheckOverlap((ObjectCtrl)(selectObject as OCItem)); Singleton <CraftScene> .Instance.UICtrl.ListUICtrl.RefreshList(); return; } } selectObject.LocalEulerAngles = localEulerAngles1; }
private void Update() { if (this.DisplayTutorial) { return; } bool flag1 = Input.GetKey((KeyCode)306) | Input.GetKey((KeyCode)305); if (this.uiCtrl.SaveLoadUICtrl.Visible || Singleton <Scene> .IsInstance() && Singleton <Scene> .Instance.IsNowLoadingFade || (this.IsEndCheck || this.IsEnd || (this.IsInputNow || this.IsGuide)) || (this.IsDialog || this.IsShortcutUI || (this.CheckAddScene() || this.IsWorkingUI))) { return; } if (Input.GetKeyDown((KeyCode)283)) { Singleton <Game> .Instance.LoadShortcut(4, (Action)null); } else { if (!flag1) { return; } bool flag2 = Input.GetKey((KeyCode)304) | Input.GetKey((KeyCode)303); if (Input.GetKeyDown((KeyCode)122)) { if (flag2) { if (!Singleton <UndoRedoManager> .IsInstance()) { return; } Singleton <UndoRedoManager> .Instance.Redo(); } else { if (!Singleton <UndoRedoManager> .IsInstance()) { return; } Singleton <UndoRedoManager> .Instance.Undo(); } } else if (Input.GetKeyDown((KeyCode)113)) { this.uiCtrl.SystemUICtrl.Axis = !this.uiCtrl.SystemUICtrl.Axis; } else if (Input.GetKeyDown((KeyCode)97)) { this.uiCtrl.SystemUICtrl.Grid = !this.uiCtrl.SystemUICtrl.Grid; } else if (Input.GetKeyDown((KeyCode)115)) { this.uiCtrl.SystemUICtrl.Save(); } else if (Input.GetKeyDown((KeyCode)100)) { this.uiCtrl.ListUICtrl.Duplicate(); } else if (Input.GetKeyDown((KeyCode)102)) { ObjectCtrl[] selectObjects = Singleton <Selection> .Instance.SelectObjects; ObjectCtrl objectCtrl = ((IList <ObjectCtrl>)selectObjects).IsNullOrEmpty <ObjectCtrl>() ? (ObjectCtrl)null : ((IEnumerable <ObjectCtrl>)selectObjects).Where <ObjectCtrl>((Func <ObjectCtrl, bool>)(v => Object.op_Inequality((Object)v.GameObject, (Object)null))).FirstOrDefault <ObjectCtrl>((Func <ObjectCtrl, bool>)(v => v.Kind == 0)); if (objectCtrl == null) { return; } this.craftCamera.TargetPos = ((CinemachineVirtualCameraBase)this.craftCamera).get_LookAt().get_parent().InverseTransformPoint(objectCtrl.Position); } else { if (!Input.GetKeyDown((KeyCode)103)) { return; } this.overlapObjectCtrl = this.craftInfo.FindOverlapObject(this.overlapObjectCtrl); if (this.overlapObjectCtrl == null) { return; } this.uiCtrl.ListUICtrl.Select(this.overlapObjectCtrl); } } }
public override bool CheckOverlap(ObjectCtrl _oc, bool _load = false) { if (Object.op_Equality((Object)this.ItemComponent, (Object)null) || !(_oc is OCItem _oc1) || this == _oc1) { return(false); } if (_load && this.CheckedOverlap.Contains(_oc1)) { return(this.HashOverlap.Contains(_oc1)); } if (!_oc1.ItemComponent.overlap || !this.ItemComponent.overlap) { if (_load) { this.CheckedOverlap.Add(_oc1); _oc1.CheckedOverlap.Add(this); } return(false); } bool flag = false; IEnumerable <Collider> overlapColliders1 = _oc1.OverlapColliders; if (!overlapColliders1.IsNullOrEmpty <Collider>()) { Vector3 zero = Vector3.get_zero(); float num = 0.0f; IEnumerable <Collider> overlapColliders2 = this.OverlapColliders; if (overlapColliders2.IsNullOrEmpty <Collider>()) { Bounds bounds = (Bounds)null; ((Bounds) ref bounds).SetMinMax(this.ItemComponent.min, this.ItemComponent.max); BoxCollider boxCollider = Singleton <CraftScene> .Instance.TestColliders.SafeGet <BoxCollider>(0); boxCollider.set_center(((Bounds) ref bounds).get_center()); boxCollider.set_size(Vector3.op_Subtraction(((Bounds) ref bounds).get_size(), OCItem.correctionSize)); using (IEnumerator <Collider> enumerator = overlapColliders1.GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { Collider current = enumerator.Current; flag |= Physics.ComputePenetration((Collider)boxCollider, this.Position, this.Rotation, current, ((Component)current).get_transform().get_position(), ((Component)current).get_transform().get_rotation(), ref zero, ref num); } } } else { using (IEnumerator <Collider> enumerator1 = overlapColliders1.GetEnumerator()) { while (((IEnumerator)enumerator1).MoveNext()) { Collider current1 = enumerator1.Current; using (IEnumerator <Collider> enumerator2 = overlapColliders2.GetEnumerator()) { while (((IEnumerator)enumerator2).MoveNext()) { Collider current2 = enumerator2.Current; flag |= Physics.ComputePenetration(current1, ((Component)current1).get_transform().get_position(), ((Component)current1).get_transform().get_rotation(), current2, ((Component)current2).get_transform().get_position(), ((Component)current2).get_transform().get_rotation(), ref zero, ref num); } } } } } } else { flag = this.CheckOverlapSize(_oc1); } if (flag) { this.HashOverlap.Add(_oc1); _oc1.HashOverlap.Add(this); } else { this.HashOverlap.Remove(_oc1); _oc1.HashOverlap.Remove(this); } if (_load) { this.CheckedOverlap.Add(_oc1); _oc1.CheckedOverlap.Add(this); } return(flag); }