Отладка модуля витрины, правки в солверах, мелкие доработки

This commit is contained in:
se_ga 2026-02-27 17:56:44 +03:00
parent 88493e2236
commit 8d576c3af2
12 changed files with 410 additions and 76 deletions

View File

@ -11349,7 +11349,7 @@ Material:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 0.6417732, g: 0, b: 1, a: 1}
- _GlowColor: {r: 0, g: 0.086306095, b: 1, a: 1}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0.554717, g: 0.554717, b: 0.554717, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -16607,7 +16607,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 687989434}
- component: {fileID: 687989435}
m_Layer: 0
m_Name: TopLeftSlot
m_TagString: Untagged
@ -16630,58 +16629,6 @@ Transform:
m_Children: []
m_Father: {fileID: 2081516970}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &687989435
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 687989433}
m_Enabled: 0
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1.0227977, y: 1.0208}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &693385447
GameObject:
m_ObjectHideFlags: 0
@ -51551,7 +51498,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1749880614
RectTransform:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,266 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &600622028
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 600622030}
- component: {fileID: 600622029}
m_Layer: 0
m_Name: scriptHolder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &600622029
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 600622028}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9bc9f2719db463041af996b2dfc020e8, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &600622030
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 600622028}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -35.211643, y: 0.5978498, z: -0.09944603}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &842588986
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 842588989}
- component: {fileID: 842588988}
- component: {fileID: 842588987}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &842588987
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 842588986}
m_Enabled: 1
--- !u!20 &842588988
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 842588986}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &842588989
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 842588986}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 842588989}
- {fileID: 600622030}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7d8f8d0070f2bf745bc49b6b21a1885d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,67 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
public class StandTester : MonoBehaviour
{
int h;
bool initialized = false;
void Start()
{
PrizeStandController.InitializationComplete += PrizeStandController_InitializationComplete;
PrizeStandController.OpeningFinished += PrizeStandController_OpeningFinished;
ComNativeWrapper.Serial_CloseAll();
h = ComNativeWrapper.Serial_Open("COM3", 115200, 8, 0, 1, 4, 10);
Debug.Log(h);
PrizeStandController.Initialize(h, 5, null);
}
private void OnDisable()
{
ComNativeWrapper.Serial_CloseAll();
}
private void PrizeStandController_InitializationComplete(bool arg1, string arg2)
{
if (arg1)
{
initialized = true;
}
Debug.Log($"Èíèöèàëèçàöèÿ. Result {arg1}; Message {arg2}");
}
private void PrizeStandController_OpeningFinished(bool arg1, string arg2)
{
Debug.Log($"Îòêðûòèå. Result {arg1}; Message {arg2}");
}
void Update()
{
if (!initialized) return;
if (Input.GetKeyDown(KeyCode.Alpha0))
{
}
if (Input.GetKeyDown(KeyCode.Alpha1))
{
Debug.Log("=====Îòêðûòü 1=====");
_ = PrizeStandController.OpenBoxAsync(1);
}
if (Input.GetKeyDown(KeyCode.Alpha2))
{
Debug.Log("=====Îòêðûòü 2=====");
_ = PrizeStandController.OpenBoxAsync(2);
}
if (Input.GetKeyDown(KeyCode.Alpha3))
{
Debug.Log("=====Îòêðûòü 3=====");
_ = PrizeStandController.OpenBoxAsync(3);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9bc9f2719db463041af996b2dfc020e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -36,7 +36,8 @@ public class CoinCounter : MonoBehaviour
public void SetRevengePriceVisibility(bool visibility)
{
revengeSignGo?.SetActive(visibility);
if(revengeSignGo != null) revengeSignGo.SetActive(visibility);
int priceRevenge = PlayerPrefs.GetInt("PriceRevenge", 10);
int pricePve = PlayerPrefs.GetInt("PricePVE", 10);
string valutaName = PlayerPrefs.GetString("ValutaName", "руб.");

View File

@ -30,7 +30,7 @@ public class BotThinkingState : IState
//Установка пресета сложности
DifficultyPreset currentPreset = CharacterController.CurrentCharacter.CurrentDifficultyPreset;
Debug.Log(currentPreset.Description);
//Debug.Log(currentPreset.Description);
if (GameManager.instance.dummyBots)
currentPreset = GameManager.instance.dummyPreset;
@ -74,7 +74,7 @@ public class BotThinkingState : IState
//подсчет времени
if(calculatedColumn!= -1 && !displayed)
{
Debug.Log($"Думал: {Time.time - startTime}");
//Debug.Log($"Думал: {Time.time - startTime}");
displayed = true;
}

View File

@ -323,7 +323,7 @@ public static class ComWrapper
if (count >= maxCount) break;
if(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - startTime >= timeout) break;
}
Debug.Log("count coins " + count);
Debug.Log($"Before game coins: {count}");
}
/// <summary>

View File

@ -153,11 +153,11 @@ public class DualAvatarController : MonoBehaviour
}
private void NewRound(CellState lastRoundWinner)
{
Debug.Log("NEW ROUND LAST WINNER " + lastRoundWinner);
//Debug.Log("NEW ROUND LAST WINNER " + lastRoundWinner);
}
private void EndGame(CellState gameWinner)
{
Debug.Log("ENDGAME");
//Debug.Log("ENDGAME");
}
#endregion

View File

@ -100,6 +100,18 @@ public static class PrizeStandController
return;
}
//очистка пол сук
await Task.Run(() =>
{
byte[] buf = new byte[1024];
var sw = Stopwatch.StartNew();
while (sw.Elapsed.TotalSeconds < 0.5)
{
ComNativeWrapper.Serial_ReadLineUTF8_bytes(handle, buf, buf.Length);
}
});
try
{
//Валидация
@ -114,6 +126,7 @@ public static class PrizeStandController
//Обработка результатов
BoxStatus openStatus = await ReadBoxStatus(boxNumber, 1, WAIT_OPEN_STATUS_TIMEOUT);
UnityEngine.Debug.Log($"Получен статус открытия {openStatus}");
if (openStatus == BoxStatus.OPENED)
{
OpeningFinished?.Invoke(true, $"Ячейка {boxNumber} успешно открыта");
@ -222,7 +235,13 @@ public static class PrizeStandController
string entry = Encoding.UTF8.GetString(buffer, 0, entryLength).Trim();
if (!entry.StartsWith("BOX"))
{
continue;
}
var ParseResult = ParseBoxStatus(entry);
UnityEngine.Debug.Log($"{ParseResult.BoxNumber} : {ParseResult.Status}");
if(ParseResult.BoxNumber == -1)
{
@ -236,6 +255,9 @@ public static class PrizeStandController
}
}
if (boxesRecieved == expectedEntriesCount) UnityEngine.Debug.Log("Все коробки считаны");
if (sw.Elapsed.TotalSeconds >= timeout) UnityEngine.Debug.Log("Вышли по таймауту");
if (status == BoxStatus.NotFound)
_logger?.Log($"[Модуль витрины. Не дождался ответа по статусу ячейки]\n" +
$"Ожидаемый номер: {expectedBoxNumber}\n" +
@ -283,9 +305,8 @@ public static class PrizeStandController
"OK" => BoxStatus.OK,
"OK+CARD" => BoxStatus.OKplusCard,
"EMPTY" => BoxStatus.Empty,
"OPEN" => BoxStatus.Open,
"OPENED" => BoxStatus.OPENED,
"OPEN" => BoxStatus.OPENED,
"OPEN_ERROR" => BoxStatus.OPEN_ERROR,
"ERROR" => BoxStatus.Error,

View File

@ -10,16 +10,17 @@ using System.Numerics;
public static class SolverV2
{
// Поле 6x7 (стандарт Connect4)
private const int WIDTH = 7;
private const int HEIGHT = 6;
private const int H1 = HEIGHT + 1; // 7: с "сентинел" битом на верх колонки
private const int MAX_MOVES = WIDTH * HEIGHT; // 42
private static int WIDTH = 7;
private static int HEIGHT = 6;
private static int CenterCol => WIDTH / 2;
private static int H1 => HEIGHT + 1; //"сентинел" битом на верх колонки
private static int MAX_MOVES => WIDTH * HEIGHT;
/// <summary>
/// Можешь крутить глубину снаружи (чем выше — тем сильнее, но медленнее).
/// Реально "очень высокие" глубины становятся возможны за счёт TT и битбордов.
/// </summary>
public static int MaxDepth = 21;
public static int MaxDepth = 20;
/// <summary>
/// Ограничение на размер TT (чтобы не раздувать память). При переполнении — чистим.
@ -27,7 +28,8 @@ public static class SolverV2
public static int TranspositionMaxEntries = 1_200_000;
// Порядок ходов: центр -> к краям (лучше и для игры, и для отсечений)
private static readonly int[] MoveOrder = { 3, 2, 4, 1, 5, 0, 6 };
//private static readonly int[] MoveOrder = { 3, 2, 4, 1, 5, 0, 6 };
private static readonly int[] MoveOrder;
// Битовые маски по колонкам
private static readonly ulong[] BottomMask = new ulong[WIDTH];
@ -51,6 +53,9 @@ public static class SolverV2
static SolverV2()
{
WIDTH = GameManager.instance.Cols;
HEIGHT = GameManager.instance.Rows;
MoveOrder = GenerateMoveOrder();
// Инициализация масок колонок
for (int c = 0; c < WIDTH; c++)
{
@ -62,7 +67,17 @@ public static class SolverV2
// Генерация всех выигрышных линий (четвёрок)
WinningLineMasks = BuildWinningMasks();
}
private static int[] GenerateMoveOrder()
{
int center = WIDTH / 2;
var order = new List<int> { center };
for (int i = 1; i <= center; i++)
{
if (center - i >= 0) order.Add(center - i);
if (center + i < WIDTH) order.Add(center + i);
}
return order.ToArray();
}
/// <summary>
/// Главный метод: верни индекс колонки 0..6, куда бросать фишку.
/// </summary>
@ -94,7 +109,7 @@ public static class SolverV2
if (mask == 0)
{
// На пустом поле лучший ход — центр
return 3;
return WIDTH / 2;
}
// Камень текущего игрока
@ -209,7 +224,7 @@ public static class SolverV2
int bestValue = -INF;
// ordering: TT best first
int ttBest = (entry.BestCol <= 6) ? entry.BestCol : -1;
int ttBest = (entry.BestCol <= WIDTH - 1) ? entry.BestCol : -1;
Span<int> cols = stackalloc int[WIDTH];
int n = BuildOrderedMoves(p, cols, ttBest);
@ -240,7 +255,7 @@ public static class SolverV2
{
Value = (short)bestValue,
Depth = (byte)depth,
BestCol = (byte)(bestCol == 255 ? 3 : bestCol),
BestCol = (byte)(bestCol == 255 ? CenterCol : bestCol),
Bound = Bound.Exact
};
@ -287,7 +302,7 @@ public static class SolverV2
private static int CenterControlBonus(ulong bits)
{
// колонка 3 (центр)
int c = 3;
int c = CenterCol;
ulong col = ((1UL << HEIGHT) - 1UL) << (c * H1);
int count = PopCount(bits & col);
return count; // чем больше в центре, тем лучше
@ -384,7 +399,7 @@ public static class SolverV2
private static bool TryGetTTBestMove(Position p, out int bestCol)
{
if (TT.TryGetValue(p.Key(), out var e) && e.BestCol <= 6)
if (TT.TryGetValue(p.Key(), out var e) && e.BestCol <= WIDTH - 1)
{
bestCol = e.BestCol;
return true;
@ -480,7 +495,6 @@ public static class SolverV2
}
}
}
return list.ToArray();
}
}