private BoxGizmo CreateEntityGizmo(EntityData entityData) { YHDebug.LogFormat("create gizmo {0}", entityData.id); if (entityData.id <= 0) //|| entityData.beltId != 0 { return(null); } BoxGizmo gizmo = null; ItemProto itemProto2 = LDB.items.Select(entityData.protoId); Vector3 position = entityData.pos; float num = itemProto2.prefabDesc.buildCollider.ext.magnitude * 0.7f; if (entityData.inserterId == 0) { gizmo = BoxGizmo.Create(entityData.pos, entityData.rot, itemProto2.prefabDesc.selectCenter, itemProto2.prefabDesc.selectSize); } else { ColliderData colliderData2 = player.planetData.physics.GetColliderData(entityData.colliderId); colliderData2.ext.x += 0.1f; gizmo = BoxGizmo.Create(colliderData2.pos, colliderData2.q, Vector3.zero, colliderData2.ext * 2f); } gizmo.multiplier = 1f; gizmo.alphaMultiplier = itemProto2.prefabDesc.selectAlpha; gizmo.fadeInScale = 1.3f; gizmo.fadeInTime = 0.05f; gizmo.fadeInFalloff = 0.5f; gizmo.fadeOutScale = 1.3f; gizmo.fadeOutTime = 0.05f; gizmo.fadeOutFalloff = 0.5f; gizmo.color = Color.white; return(gizmo); }
private void ExitBluePrintMode() { YHDebug.Log("exit bp mode"); m_EnterFactoryBPMode = false; m_BPBuild = false; m_BPCreate = false; m_FactoryBPUI.ExitBP(); m_FactoryBP.Clear(); }
private void UpdateBuildPreviewsPosition(Vector3 mousePos) { YHDebug.LogFormat("UpdateBuildPreviewsPosition:mouse pos :{0}", mousePos); Vector3 groundPos = Vector3.zero; if (m_FactoryBP.TryScreenPositionToGroundPosition(mousePos, ref groundPos)) { YHDebug.LogFormat("UpdateBuildPreviewsPosition:ground pos :{0}", groundPos); m_FactoryBP.UpdateBuildPosition(groundPos); } }
protected override void _OnClose() { YHDebug.Log("bp create close"); m_SelectEntities.Clear(); m_NeedRemoveGizmosKeys.Clear(); foreach (var iter in m_SelectEntitiesGizmo) { iter.Value.Close(); } m_SelectEntitiesGizmo.Clear(); }
private void EnterBluePrintMode() { YHDebug.Log("enter bp mode"); m_EnterFactoryBPMode = true; //check planet data PlanetData planetData = GameMain.localPlanet; if (planetData != null && planetData != m_FactoryBP.planetData) { m_FactoryBP.SetPlanetData(planetData); m_FactoryBP.player = GameMain.mainPlayer; } m_FactoryBPUI.EnterBP(); }
public override void EscLogic() { YHDebug.LogFormat("bp create esc logic {0}", controller.cmd.mode); bool num = !VFInput._godModeMechaMove; bool flag = VFInput.rtsCancel.onDown || VFInput.escKey.onDown || VFInput.escape || VFInput._buildModeKey.onDown; bool flag2 = !VFInput.onGUI && VFInput.inScreen; if (num && flag && flag2) { VFInput.UseBuildKey(); VFInput.UseEscape(); VFInput.UseRtsCancel(); TrarckPlugin.Instance.isBPCreate = false; _Close(); } }
public void CreateAction() { if (VFInput._buildConfirm.onDown && m_SelectEntities.Count > 0) { YHDebug.LogFormat("Create bp {0}", m_SelectEntities.Count); if (GameMain.localPlanet != null) { //过滤 List <EntityData> filterEntities = FilterEntitis(m_SelectEntities); YHDebug.LogFormat("Create bp after filter {0}", filterEntities.Count); //排序 by entity id filterEntities.Sort(SortEntityDataCompare); List <EntityData> sortedEntities = filterEntities; CreateBluePrint(sortedEntities); } m_SelectEntities.Clear(); } }
void Update() { //进入蓝图模式或退出 if (GameMain.mainPlayer != null && GameMain.mainPlayer.controller != null && GameMain.mainPlayer.controller.cmd.type == ECommand.Build) { //更新键盘事件 KeyManager.Instance.Update(); if (m_BPEnterKey.IsDown() || m_AutoEnterBPMode) { m_AutoEnterBPMode = false; if (m_EnterFactoryBPMode) { ExitBluePrintMode(); } else { EnterBluePrintMode(); } } } else if (m_EnterFactoryBPMode) { m_AutoEnterBPMode = true; //退出蓝图模式 ExitBluePrintMode(); return; } //蓝图功能 if (m_EnterFactoryBPMode) { if (m_CreateBluePrintKey.IsDown()) { YHDebug.Log("On create bp Key down"); m_BPCreate = true; m_BPBuild = false; } if (m_BuildBluePrintKey.IsDown()) { YHDebug.Log("On build bp entities Key down"); //build //CreateBuildPreviews(Input.mousePosition); m_BPBuild = true; m_BPCreate = false; } if (m_SaveBPKey.IsDown()) { YHDebug.Log("On save bp Key down"); //save SaveCurrentBPData(); } if (m_ExportLapJointKey.IsDown()) { ExportModelLapJot(); } //if (m_BPBuild) //{ // //取消build // if (Input.GetMouseButtonDown(1) && (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))) // { // m_BPBuild = false; // } //} //if (m_BPCreate) //{ // //取消create // if (Input.GetMouseButtonDown(1) && (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))) // { // m_BPCreate = false; // } //} } }
protected override void _OnOpen() { YHDebug.Log("bp create open"); }