cocos-farm/source_export/source_runtime_notes.md

5.2 KiB

Source Runtime Notes

  • Startup scene source has Canvas/root/ui/scene and two cameras.
  • Stage 1A decodes the window and camera source values: design size 720 x 1280, root/scene size 3320 x 2560, main camera position (0, 0, 1000), orthographic height 640, _near=0, and _far=2000.
  • Stage 1A camera visibility is 1083179010. Generated world nodes use source layer bit 1073741824; UI_2D layer 33554432 is not used for these world nodes because the source camera does not include it.
  • Startup scene Canvas source row [15,-6,-5] resolves _cameraComponent=-5 through compiled-json refs record [0,3,7], so Canvas binds the root/ui/uiCamera component. The main world camera is not Canvas-bound; its Camera component serializes _orthoHeight=640, and the source camera-controller minZoom=0.8 makes the generated startup world-camera height 640 / 0.8 = 800.
  • At tall viewport 686 x 1502, runtime verification reports view.scaleX=view.scaleY=0.9527777777777777, mainCamera.orthoHeight=800, and uiCamera.orthoHeight=788.2215743440233. The empty-land bubble, seed list, and selected-land frame are UI-layer nodes rendered by root/ui/uiCamera, so their screen size is source UI size multiplied by the current SHOW_ALL view scale, with node world scale still (1,1,1).
  • Stage 1A mounts farm_scene_v3 at (0, -43.566, 0) and emits only world-map background nodes.
  • Stage 1A background resources are runtime-selected by FarmEnv, not by the low-resolution model/v3/scene fallback textures.
  • FarmEnv id 6 binds farm_scene_v3/Scene/BgLayer/defaultbg to delayRes/scene/bg/spriteFrame, position (0, 1248.749), size 3320 x 1404.
  • FarmEnv id 7 binds farm_scene_v3/Scene/FgLayer/default to delayRes/scene/fg/spriteFrame, position (0, -316.229), size 3320 x 2472.
  • Cocos Creator 3.8 import rules for Stage 1A must preserve source SpriteFrame metadata and source pixel dimensions for scene/bg and scene/fg.
  • farm_scene_v3_sprite contains 36 static visual land cells under Scaled/Rotate/GridOrigin.
  • The visible land count rule is decoded from farm_scene_v3: gridX=4, gridY=6, 24 visual grid_* nodes, plus matching PlantOrigin logic points. The 36-cell farm_scene_v3_sprite grid is excluded from visible-land placement.
  • Each visible grid_*/icon is serialized as source sp.Skeleton, with UITransform 161.32 x 96.02, anchor about (0.494, 0.503), local position (98.011, 0, 0), _preCacheMode=1, _cacheMode=1, and _enableBatch=true.
  • Source scene_land sp.SkeletonData is embedded in the compact prefab and contains atlasText, textureNames ["scene_land.png"], skeletonJson, skins, and animations including land_valid1..5, land_dry1..5, and land_locked.
  • Cocos Creator 3.8 requires scene_land to be generated as an external spine-data asset. Inline scene sp.SkeletonData was stripped from _skeletonData references by the web-mobile build, leaving invisible lands.
  • Stage 1B generated external assets/spine/stage1/scene_land.json, .atlas, .png; runtime capture requested the generated atlas PNG and ROI passed.
  • Default house and doghouse come from SkinCfg records 201001 and 205001, not only from the static visual prefab.
  • Bottom menu source nodes are under main_ui_v2/Menu; feature logic for warehouse/shop/friend/task is outside first-stage scope.
  • Current two-layer viewport pass no longer regenerates CocosFarm/assets through tools/generate_creator_project.py. The Cocos Creator project settings use the source design resolution 720 x 1280, policy 2.
  • Current runtime layer split: root/scene owns the main map layer and Stage1MainWorldLayer; root/ui owns the fixed UI layer and Stage1FixedUiLayer.
  • root/scene/Camera and root/ui/uiCamera remain as required Cocos render cameras. The old camera-node viewport-control scripts are not attached to the camera nodes.
  • Stage1MainWorldLayer preserves the source startup map view by assigning the source-derived main camera orthographic height 640 / 0.8 = 800.
  • Stage1FixedUiLayer keeps UI in source Cocos design coordinates by assigning the UI camera orthographic height to 1280 / 2 and keeping the root/ui UITransform at 720 x 1280.
  • Runtime calls to view.setDesignResolutionSize() are intentionally absent from the layer components. The runtime capture proved calling it inside resize callbacks can keep firing design-resolution events and produce a black frame.
  • Under the current two-layer rule, land click hit testing projects each grid_*/icon center through the main camera, while popup placement converts that screen position through the fixed UI camera.
  • Runtime verification should report design resolution 720 x 1280, mainCamera.orthoHeight=800, and uiCamera.orthoHeight=640; official device preview must not replace the recovered source UI coordinate system with its current CSS visible size.
  • Browser preview may still scale the outer canvas to fit the selected device shell, but the recovered scene and fixed UI layers stay in source 720 x 1280 coordinates.
  • Runtime blank-click verification reports interaction hidden after non-land click: interactionActive=false, landBubbleActive=false, seedBg3.activeInHierarchy=false, seedBg5.activeInHierarchy=false, and selected frame inactive.