Esempio n. 1
0
        public static void PlayerAction_Build_SetCopyInfo_Postfix(ref PlayerAction_Build __instance, int objectId)
        {
            if (bpMode)
            {
                EndBpMode(true);
            }
            BlueprintManager.PrepareNew();
            if (objectId < 0)
            {
                return;
            }

            var itemProto = LDB.items.Select(__instance.factory.entityPool[objectId].protoId);

            if (itemProto.prefabDesc.insertPoses.Length > 0)
            {
                BlueprintManager.Copy(objectId);

                if (BlueprintManager.hasData)
                {
                    BlueprintManager.data.copiedBuildings[0].recipeId = __instance.copyRecipeId;
                    __instance.yaw = 0f;
                }
            }
        }
Esempio n. 2
0
        public static void EndBpMode(bool ignoreBlueprint = false)
        {
            if (!bpMode)
            {
                return;
            }

            if (!ignoreBlueprint)
            {
                var ids = bpSelection.Keys.ToList();

                BlueprintManager.Copy(ids, referenceId);

                if (BlueprintManager.hasData)
                {
                    BlueprintManager.EnterBuildModeAfterBp();
                }
            }

            bpMode      = false;
            referenceId = 0;
            foreach (var selectionGizmo in bpSelection.Values)
            {
                selectionGizmo.Close();
            }

            bpSelection.Clear();
            if (areaSelectionGizmo != null)
            {
                areaSelectionGizmo.Close();
                areaSelectionGizmo = null;
            }
            if (referenceGizmo != null)
            {
                referenceGizmo.Close();
                referenceGizmo = null;
            }
            if (referenceSelectionGizmo != null)
            {
                referenceSelectionGizmo.Close();
                referenceSelectionGizmo = null;
            }



            GC.Collect();
        }