private void RegisterEditButtonEvent(UIEditTypeButton editButton, MachineEditType editType) { editButton.SetClickEvent (() => { var sceneCtrl = (GarageCtrl)MainCtrl.GetInstance ()._currentSceneCtrl; if (sceneCtrl._editType == editType) { sceneCtrl.ChangeEditType (MachineEditType.None); } else { sceneCtrl.ChangeEditType (editType); } _partsList.ChangeMachineEditMode (sceneCtrl._editType); _partsList.SetActive (sceneCtrl._isEditMode); _partsParams.SetActive (sceneCtrl._isEditMode); _partsParams.ChangeDisp (GetCurrentPart (sceneCtrl._editType)); ChangeActiveEditButtons (sceneCtrl._editType); }); }
private MachinePartsBase GetCurrentPart(MachineEditType editType) { switch (editType) { case MachineEditType.Frame: return Utilities.machinePartsUtility.GetFrame ( MainCtrl.GetInstance ()._userInfo.frameId ); case MachineEditType.Generator: return Utilities.machinePartsUtility.GetGenerator ( MainCtrl.GetInstance ()._userInfo.generatorId ); case MachineEditType.Booster: return Utilities.machinePartsUtility.GetBooster ( MainCtrl.GetInstance ()._userInfo.boosterId ); default: return MachinePartsBase.CreateInstance<MachinePartsBase> (); } }
private void ChangeActiveEditButtons(MachineEditType editType) { _editFrame.SetActive (editType == MachineEditType.Frame); _editGenerator.SetActive (editType == MachineEditType.Generator); _editBooster.SetActive (editType == MachineEditType.Booster); }
public void ChangeEditType(MachineEditType editType) { _editType = editType; _isEditMode = (_editType != MachineEditType.None); }