Decompiled source of DSPDouDizhu v2.2.0
BepInEx\plugins\DSPDouDizhu\DSPDouDizhu.dll
Decompiled 19 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DouDizhuMod.Engine; using HarmonyLib; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("2.2.0.0")] [assembly: AssemblyInformationalVersion("2.2.0")] [assembly: AssemblyVersion("2.2.0.0")] namespace DouDizhuMod { internal sealed class HiveThreatSnapshot { public EnemyDFHiveSystem Hive; public EvolveData Evolve; public int RelayNeutralizedCounter; } internal sealed class BaseThreatSnapshot { public DFGBaseComponent Base; public EvolveData Evolve; } internal sealed class ThreatGuard { private readonly List<HiveThreatSnapshot> _hives = new List<HiveThreatSnapshot>(16); private readonly List<BaseThreatSnapshot> _bases = new List<BaseThreatSnapshot>(64); private float _until = -1f; private float _seconds; public bool Active => _until > 0f; public float Remaining { get { if (!(_until <= 0f)) { return Mathf.Max(0f, _until - Time.realtimeSinceStartup); } return 0f; } } public ThreatGuard(float seconds) { _seconds = seconds; } public void Configure(float seconds) { _seconds = seconds; } public void SnapshotAll(PlanetFactory factory) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) _hives.Clear(); _bases.Clear(); SpaceSector val = GameMain.data?.spaceSector; if (val != null && val.dfHives != null) { EnemyDFHiveSystem[] dfHives = val.dfHives; foreach (EnemyDFHiveSystem val2 in dfHives) { if (val2 != null) { HiveThreatSnapshot hiveThreatSnapshot = new HiveThreatSnapshot(); hiveThreatSnapshot.Hive = val2; hiveThreatSnapshot.Evolve = val2.evolve; hiveThreatSnapshot.RelayNeutralizedCounter = val2.relayNeutralizedCounter; _hives.Add(hiveThreatSnapshot); } } } if (factory != null && factory.enemySystem != null && factory.enemySystem.bases != null) { ObjectPool<DFGBaseComponent> bases = factory.enemySystem.bases; int cursor = bases.cursor; DFGBaseComponent[] buffer = bases.buffer; for (int j = 1; j < cursor && j < buffer.Length; j++) { DFGBaseComponent val3 = buffer[j]; if (val3 != null && val3.id == j) { BaseThreatSnapshot baseThreatSnapshot = new BaseThreatSnapshot(); baseThreatSnapshot.Base = val3; baseThreatSnapshot.Evolve = val3.evolve; _bases.Add(baseThreatSnapshot); } } } DouDizhuPlugin.Log.LogInfo((object)$"[威胁度守卫] 快照完成:蜂巢 {_hives.Count} 个,本地基地 {_bases.Count} 座"); } public void BeginGuard() { Apply(); _until = Time.realtimeSinceStartup + _seconds; } public void Tick() { if (_until < 0f) { return; } if (GameMain.data == null) { _until = -1f; return; } Apply(); if (Time.realtimeSinceStartup >= _until) { _until = -1f; DouDizhuPlugin.Log.LogInfo((object)"[威胁度守卫] 窗口期结束,威胁度保持不变"); } } private void Apply() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _hives.Count; i++) { HiveThreatSnapshot hiveThreatSnapshot = _hives[i]; if (hiveThreatSnapshot.Hive != null) { hiveThreatSnapshot.Hive.evolve = hiveThreatSnapshot.Evolve; hiveThreatSnapshot.Hive.relayNeutralizedCounter = hiveThreatSnapshot.RelayNeutralizedCounter; } } for (int j = 0; j < _bases.Count; j++) { BaseThreatSnapshot baseThreatSnapshot = _bases[j]; if (baseThreatSnapshot.Base != null) { baseThreatSnapshot.Base.evolve = baseThreatSnapshot.Evolve; } } } } internal static class DarkFogBridge { public static int CountGroundDarkFog(PlanetFactory factory) { if (factory == null || factory.enemyPool == null) { return 0; } int num = 0; int enemyCursor = factory.enemyCursor; EnemyData[] enemyPool = factory.enemyPool; for (int i = 1; i < enemyCursor && i < enemyPool.Length; i++) { if (enemyPool[i].id == i) { num++; } } return num; } public static string WipeGroundDarkFog(PlanetFactory factory, ThreatGuard guard) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (factory == null || factory.enemyPool == null) { return "工厂未加载"; } if (GameMain.data == null) { return "存档未加载"; } guard?.SnapshotAll(factory); EnemyData[] enemyPool = factory.enemyPool; int enemyCursor = factory.enemyCursor; List<int> list = new List<int>((enemyCursor > 16) ? enemyCursor : 16); int num = 0; for (int i = 1; i < enemyCursor && i < enemyPool.Length; i++) { if (enemyPool[i].id == i) { if (enemyPool[i].dynamic || enemyPool[i].unitId > 0) { num++; } else { list.Add(i); } } } CombatStat val = default(CombatStat); ((CombatStat)(ref val)).Reset(); int num2 = 0; for (int j = 0; j < 2; j++) { for (int k = 0; k < list.Count; k++) { int num3 = list[k]; if (num3 <= 0 || num3 >= enemyPool.Length || enemyPool[num3].id != num3) { continue; } bool flag = enemyPool[num3].dfGBaseId > 0; if (!(j == 0 && flag) && (j != 1 || flag)) { try { factory.KillEnemyFinally(num3, ref val); num2++; } catch (Exception ex) { DouDizhuPlugin.Log.LogWarning((object)$"[全灭] 摧毁建筑 #{num3} 失败:{ex.Message}"); } } } } guard?.BeginGuard(); string text = $"已清除 {num2}/{list.Count} 座建筑 · 保留小兵 {num} 个"; DouDizhuPlugin.Log.LogInfo((object)("[全灭] 当前星球黑雾建筑清除完成:" + text + "(威胁度快照守卫已启动)")); return text; } public static int CountGroundBuildings(PlanetFactory factory) { if (factory == null || factory.enemyPool == null) { return 0; } int num = 0; for (int i = 1; i < factory.enemyCursor && i < factory.enemyPool.Length; i++) { if (factory.enemyPool[i].id == i && !factory.enemyPool[i].dynamic && factory.enemyPool[i].unitId <= 0) { num++; } } return num; } public static int CountGroundUnits(PlanetFactory factory) { if (factory == null || factory.enemyPool == null) { return 0; } int num = 0; for (int i = 1; i < factory.enemyCursor && i < factory.enemyPool.Length; i++) { if (factory.enemyPool[i].id == i && (factory.enemyPool[i].dynamic || factory.enemyPool[i].unitId > 0)) { num++; } } return num; } public static int ActivateAllGroundUnits(PlanetFactory factory) { if (factory == null || factory.enemySystem == null || factory.enemySystem.bases == null) { return 0; } ObjectPool<DFGBaseComponent> bases = factory.enemySystem.bases; int num = 0; for (int i = 1; i < bases.cursor && i < bases.buffer.Length; i++) { DFGBaseComponent val = bases.buffer[i]; if (val != null && val.id == i) { try { val.ActiveAllUnit(GameMain.gameTick); num++; } catch (Exception) { } } } return num; } public static string WipeGroundUnits(PlanetFactory factory, ThreatGuard guard) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (factory == null || factory.enemyPool == null) { return "工厂未加载"; } if (GameMain.data == null) { return "存档未加载"; } guard?.SnapshotAll(factory); EnemyData[] enemyPool = factory.enemyPool; int enemyCursor = factory.enemyCursor; List<int> list = new List<int>((enemyCursor > 16) ? enemyCursor : 16); for (int i = 1; i < enemyCursor && i < enemyPool.Length; i++) { if (enemyPool[i].id == i && (enemyPool[i].dynamic || enemyPool[i].unitId > 0)) { list.Add(i); } } CombatStat val = default(CombatStat); ((CombatStat)(ref val)).Reset(); int num = 0; for (int j = 0; j < list.Count; j++) { int num2 = list[j]; if (num2 > 0 && num2 < enemyPool.Length && enemyPool[num2].id == num2) { try { factory.KillEnemyFinally(num2, ref val); num++; } catch (Exception ex) { DouDizhuPlugin.Log.LogWarning((object)$"[清剿] 击杀小兵 #{num2} 失败:{ex.Message}"); } } } guard?.BeginGuard(); string text = $"已清除 {num}/{list.Count} 个小兵"; DouDizhuPlugin.Log.LogInfo((object)("[清剿] 当前星球黑雾小兵清除完成:" + text + "(威胁度快照守卫已启动)")); return text; } public static int CountRelays(StarData star) { if (star == null || GameMain.data == null || GameMain.data.spaceSector == null) { return 0; } SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector.dfHives == null) { return 0; } int num = 0; for (int i = 0; i < spaceSector.dfHives.Length; i++) { EnemyDFHiveSystem val = spaceSector.dfHives[i]; if (val != null && val.isAlive && val.starData != null && val.starData.id == star.id) { num += val.relayCount; } } return num; } public static string WipeRelays(StarData star, ThreatGuard guard) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (star == null || GameMain.data == null || GameMain.data.spaceSector == null) { return "星域未加载"; } SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector.dfHives == null || spaceSector.enemyPool == null) { return "星域未加载"; } guard?.SnapshotAll(null); CombatStat val = default(CombatStat); ((CombatStat)(ref val)).Reset(); int num = 0; int num2 = 0; EnemyData[] enemyPool = spaceSector.enemyPool; for (int i = 0; i < spaceSector.dfHives.Length; i++) { EnemyDFHiveSystem val2 = spaceSector.dfHives[i]; if (val2 == null || !val2.isAlive || val2.starData == null || val2.starData.id != star.id) { continue; } ObjectPool<DFRelayComponent> relays = val2.relays; if (relays == null || relays.buffer == null) { continue; } for (int j = 1; j < relays.cursor && j < relays.buffer.Length; j++) { DFRelayComponent val3 = relays.buffer[j]; if (val3 == null || val3.id != j) { continue; } num2++; int enemyId = val3.enemyId; if (enemyId > 0 && enemyId < enemyPool.Length && enemyPool[enemyId].id == enemyId) { try { spaceSector.KillEnemyFinal(enemyId, ref val); num++; } catch (Exception ex) { DouDizhuPlugin.Log.LogWarning((object)$"[清剿] 击杀中继站 #{enemyId} 失败:{ex.Message}"); } } } } guard?.BeginGuard(); string text = $"已清除 {num}/{num2} 个中继站"; DouDizhuPlugin.Log.LogInfo((object)("[清剿] 本星系中继站清除完成:" + text + "(威胁度快照守卫已启动)")); return text; } public static string EnrageDarkFog(PlanetFactory factory) { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; if (factory != null && factory.enemySystem != null && factory.enemySystem.bases != null) { ObjectPool<DFGBaseComponent> bases = factory.enemySystem.bases; int cursor = bases.cursor; DFGBaseComponent[] buffer = bases.buffer; for (int i = 1; i < cursor && i < buffer.Length; i++) { DFGBaseComponent val = buffer[i]; if (val != null && val.id == i) { EvolveData evolve = val.evolve; if (evolve.maxThreat > 0) { evolve.threat = evolve.maxThreat; evolve.threatshr = evolve.maxThreat; val.evolve = evolve; } num++; try { val.UnderAttack(); } catch (Exception) { } } } } SpaceSector val2 = GameMain.data?.spaceSector; if (val2 != null && val2.dfHives != null) { EnemyDFHiveSystem[] dfHives = val2.dfHives; foreach (EnemyDFHiveSystem val3 in dfHives) { if (val3 != null && val3.isAlive) { EvolveData evolve2 = val3.evolve; if (evolve2.maxThreat > 0) { evolve2.threat = evolve2.maxThreat; evolve2.threatshr = evolve2.maxThreat; val3.evolve = evolve2; } num2++; try { val3.UnderAttack(); } catch (Exception) { } } } } string text = num + " 座黑雾基地、 " + num2 + " 个黑雾巢穴"; DouDizhuPlugin.Log.LogInfo((object)("[掀桌] 威胁度拉满 100%:" + text)); return text; } public static void KillPlayer() { Player mainPlayer = GameMain.mainPlayer; if (mainPlayer == null) { DouDizhuPlugin.Log.LogWarning((object)"[处决] 找不到玩家对象"); return; } if (!mainPlayer.isAlive) { DouDizhuPlugin.Log.LogInfo((object)"[处决] 玩家已处于死亡状态,跳过"); return; } try { mainPlayer.invincibleTicks = 0; mainPlayer.Kill(); DouDizhuPlugin.Log.LogInfo((object)"[处决] 玩家已死亡(任务失败),建筑保留"); } catch (Exception arg) { DouDizhuPlugin.Log.LogError((object)$"[处决] Player.Kill 异常:{arg}"); } } } internal sealed class DDZUI { private const float WIN_W = 1140f; private const float WIN_H = 700f; private const int WindowId = 3538; private static readonly Color CardRed = new Color(0.82f, 0.13f, 0.12f); private static readonly Color CardBlack = new Color(0.13f, 0.13f, 0.16f); private static readonly Color BtnBlue = new Color(0.18f, 0.49f, 0.85f); private static readonly Color BtnGreen = new Color(0.2f, 0.66f, 0.36f); private static readonly Color BtnOrange = new Color(0.92f, 0.6f, 0.18f); private static readonly Color BtnRed = new Color(0.86f, 0.26f, 0.22f); private static readonly Color BtnGray = new Color(0.55f, 0.58f, 0.62f); private static readonly Color Gold = new Color(1f, 0.85f, 0.35f); private readonly DouDizhuPlugin _plugin; private DDZGame _game; private bool _open; private Rect _win = new Rect(210f, 90f, 1140f, 700f); private readonly HashSet<int> _selected = new HashSet<int>(); private bool _settleHandled; private float _deathCountdown = -1f; private string _wipeResult = ""; private bool _flipConfirm; private int _round = 1; private bool _awaitNextRound; private readonly List<string> _roundResults = new List<string>(3); private bool _sweeping; private float _sweepTimer; private int _sweepQuiet; private string _toast = ""; private float _toastUntil; private GameObject _blockPanel; private readonly Combo[] _tableCombo = new Combo[3]; private Font _font; private bool _ready; private Texture2D _texFelt; private Texture2D _texRounded; private Texture2D _texPill; private Texture2D _texCircle; private Texture2D _texCardFace; private Texture2D _texCardBack; private Texture2D _texWhite; private GUIStyle _txt; private GUIStyle _btnPill; private GUIStyle _btnClear; private static readonly Color[] SeatColors = (Color[])(object)new Color[3] { new Color(0.85f, 0.68f, 0.25f), new Color(0.8f, 0.36f, 0.42f), new Color(0.3f, 0.55f, 0.85f) }; public bool IsOpen => _open; public DDZUI(DouDizhuPlugin plugin) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) _plugin = plugin; try { string[] array = new string[4] { "Microsoft YaHei UI", "Microsoft YaHei", "SimHei", "SimSun" }; for (int i = 0; i < array.Length; i++) { try { Font val = Font.CreateDynamicFontFromOSFont(array[i], 15); if ((Object)(object)val != (Object)null) { _font = val; break; } } catch (Exception) { } } } catch (Exception) { } } public bool CanOpenHere(out string why) { why = null; try { if (GameMain.data == null || !GameMain.isRunning) { why = "需要先进入游戏存档"; return false; } if (GameMain.data.gameDesc == null || !GameMain.data.gameDesc.isCombatMode) { why = "当前存档未启用黑雾(需要战斗模式存档)"; return false; } PlanetData localPlanet = GameMain.localPlanet; if (localPlanet == null) { why = "请先降落到星球"; return false; } if (localPlanet.factory == null || !localPlanet.factoryLoaded) { why = "星球工厂尚未加载,请稍候"; return false; } int num = DarkFogBridge.CountGroundDarkFog(localPlanet.factory); int num2 = DarkFogBridge.CountRelays((GameMain.data != null) ? GameMain.data.localStar : null); if (num <= 0 && num2 <= 0) { why = "本星球与附近星域都没有黑雾,无处对局"; return false; } } catch (Exception ex) { why = "状态检测失败: " + ex.Message; return false; } return true; } public void Toggle() { if (_open) { Close(); } else { Open(); } } public void Open() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) _roundResults.Clear(); _flipConfirm = false; _deathCountdown = -1f; _open = true; _win = new Rect(Mathf.Max(0f, ((float)Screen.width - 1140f) * 0.5f), Mathf.Max(0f, ((float)Screen.height - 700f) * 0.5f), 1140f, 700f); StartRound(AutoPickRound()); try { CreateBlockPanel(); } catch (Exception ex) { DouDizhuPlugin.Log.LogWarning((object)("[穿透屏蔽] 遮挡板创建失败:" + ex.Message)); } } private void StartRound(int round) { _round = Mathf.Clamp(round, 1, 3); _game = new DDZGame(); _game.AiThinkSeconds = Mathf.Clamp(_plugin.CfgAiThink.Value, 0.1f, 3f); _selected.Clear(); _settleHandled = false; _awaitNextRound = false; _sweeping = false; _sweepQuiet = 0; _wipeResult = ""; for (int i = 0; i < 3; i++) { _tableCombo[i] = null; } } private int AutoPickRound() { try { PlanetFactory factory = GameMain.localPlanet?.factory; if (DarkFogBridge.CountGroundBuildings(factory) > 0) { return 1; } if (DarkFogBridge.CountGroundUnits(factory) > 0) { return 2; } } catch (Exception) { } return 3; } private string RoundStakeText(int round) { try { PlanetFactory factory = GameMain.localPlanet?.factory; switch (round) { case 1: { int num3 = DarkFogBridge.CountGroundBuildings(factory); return $"赌注(第1局):本星球黑雾建筑 ×{num3} —— 胜则建筑全清(+0威胁度),败则机毁"; } case 2: { int num2 = DarkFogBridge.CountGroundUnits(factory); return $"赌注(第2局):本星球黑雾小兵 ×{num2} —— 胜则小兵全灭,败则机毁"; } default: { int num = DarkFogBridge.CountRelays((GameMain.data != null) ? GameMain.data.localStar : null); return $"赌注(第3局):本星系中继站 ×{num} —— 胜则中继站全灭(+0威胁度),败则机毁"; } } } catch (Exception) { return "赌注:本星球黑雾"; } } public void Close() { if (_open) { _open = false; RestoreGui(); } } public void ForceCloseNoPause() { _open = false; RestoreGui(); } private void RestoreGui() { try { if ((Object)(object)_blockPanel != (Object)null) { Object.Destroy((Object)(object)_blockPanel); _blockPanel = null; } } catch (Exception) { } } private void CreateBlockPanel() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_blockPanel != (Object)null)) { GameObject val = new GameObject("DSPDouDizhu_ClickBlocker"); Canvas obj = val.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.overrideSorting = true; obj.sortingOrder = 30000; val.AddComponent<GraphicRaycaster>(); Image obj2 = val.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0f); ((Graphic)obj2).raycastTarget = true; _blockPanel = val; } } public void ShowToast(string msg) { _toast = msg; _toastUntil = Time.realtimeSinceStartup + 2.6f; } public void Tick(float dt) { if (!_open) { return; } try { if (GameMain.data == null) { ForceCloseNoPause(); return; } } catch (Exception) { } if (_game != null && _game.Phase != Phase.Settled) { _game.Tick(dt); } if (_game != null && _game.Phase == Phase.Settled && !_settleHandled) { _settleHandled = true; if (_game.HumanWon) { PlanetFactory factory = null; StarData star = null; try { factory = GameMain.localPlanet?.factory; star = ((GameMain.data != null) ? GameMain.data.localStar : null); } catch (Exception) { } try { if (_round == 1) { _wipeResult = DarkFogBridge.WipeGroundDarkFog(factory, _plugin.Guard); } else if (_round == 2) { _wipeResult = DarkFogBridge.WipeGroundUnits(factory, _plugin.Guard); } else { _wipeResult = DarkFogBridge.WipeRelays(star, _plugin.Guard); } _roundResults.Add($"第{_round}局:" + _wipeResult); } catch (Exception ex3) { _wipeResult = "执行异常: " + ex3.Message; DouDizhuPlugin.Log.LogError((object)$"[结算] 第{_round}局奖励异常:{ex3}"); } if (_round < 3) { _awaitNextRound = true; } if (_round == 2 || _round == 3) { _sweeping = true; _sweepTimer = 0.8f; _sweepQuiet = 0; try { DarkFogBridge.ActivateAllGroundUnits(GameMain.localPlanet?.factory); } catch (Exception) { } } } else { _deathCountdown = Mathf.Max(1f, _plugin.CfgDeathCountdown.Value); } } if (_deathCountdown > 0f) { _deathCountdown -= dt; if (_deathCountdown <= 0f) { Close(); DarkFogBridge.KillPlayer(); } } if (!_awaitNextRound || !_sweeping || !(_deathCountdown <= 0f)) { return; } _sweepTimer -= dt; if (!(_sweepTimer <= 0f)) { return; } _sweepTimer = 0.7f; try { PlanetFactory factory2 = GameMain.localPlanet?.factory; StarData star2 = ((GameMain.data != null) ? GameMain.data.localStar : null); if (_round == 2) { DarkFogBridge.ActivateAllGroundUnits(factory2); if (DarkFogBridge.CountGroundUnits(factory2) > 0) { _wipeResult = DarkFogBridge.WipeGroundUnits(factory2, _plugin.Guard); _sweepQuiet = 0; if (_game != null && _game.Log != null) { _game.Log.Add("巡检补刀:" + _wipeResult); } } else { _sweepQuiet++; if (_sweepQuiet >= 3) { _sweeping = false; } } } else if (_round == 3) { if (DarkFogBridge.CountRelays(star2) > 0) { _wipeResult = DarkFogBridge.WipeRelays(star2, _plugin.Guard); _sweepQuiet = 0; if (_game != null && _game.Log != null) { _game.Log.Add("巡检补刀:" + _wipeResult); } } else { _sweepQuiet++; if (_sweepQuiet >= 3) { _sweeping = false; } } } else { _sweeping = false; } } catch (Exception arg) { DouDizhuPlugin.Log.LogError((object)$"[巡检清剿] 异常:{arg}"); _sweeping = false; } } private static Texture2D GenRounded(int w, int h, float radius, Color fill, Color borderCol, float border) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; float num = (float)w * 0.5f; float num2 = (float)h * 0.5f; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num3 = (float)j + 0.5f; float num4 = (float)i + 0.5f; float num5 = Mathf.Abs(num3 - num) - (num - radius); float num6 = Mathf.Abs(num4 - num2) - (num2 - radius); float num7 = Mathf.Max(num5, 0f); float num8 = Mathf.Max(num6, 0f); float num9 = Mathf.Sqrt(num7 * num7 + num8 * num8) + Mathf.Min(Mathf.Max(num5, num6), 0f) - radius; float num10 = Mathf.Clamp01(0.5f - num9); int num11 = i * w + j; if (num10 <= 0f) { array[num11] = Color.clear; continue; } array[num11] = ((num9 < 0f - border) ? fill : borderCol); if (num9 > -1f) { array[num11].a *= Mathf.Clamp01(num9 * -1f); } } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static Texture2D GenCircle(int d, Color center, Color edge) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(d, d, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[d * d]; float num = (float)d * 0.5f; for (int i = 0; i < d; i++) { for (int j = 0; j < d; j++) { float num2 = (float)j + 0.5f - num; float num3 = (float)i + 0.5f - num; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); float num5 = Mathf.Clamp01(num - num4 + 0.5f); int num6 = i * d + j; array[num6] = Color.Lerp(center, edge, Mathf.Clamp01(num4 / num)); array[num6].a *= num5; } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static Texture2D GenCardBack(int w, int h) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.16f, 0.36f, 0.7f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.24f, 0.48f, 0.82f); float num = 4f; float num2 = (float)w * 0.5f; float num3 = (float)h * 0.5f; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num4 = (float)j + 0.5f; float num5 = (float)i + 0.5f; float num6 = Mathf.Abs(num4 - num2) - (num2 - num); float num7 = Mathf.Abs(num5 - num3) - (num3 - num); float num8 = Mathf.Max(num6, 0f); float num9 = Mathf.Max(num7, 0f); float num10 = Mathf.Sqrt(num8 * num8 + num9 * num9) + Mathf.Min(Mathf.Max(num6, num7), 0f) - num; float num11 = Mathf.Clamp01(0.5f - num10); int num12 = i * w + j; if (num11 <= 0f) { array[num12] = Color.clear; continue; } Color val4 = val2; if (num4 > 4f && num4 < (float)w - 4f && num5 > 4f && num5 < (float)h - 4f) { val4 = val3; int num13 = (j + i) % 8; if (num13 < 2) { val4 = val2; } if (num4 > 6f && num4 < (float)w - 6f && num5 > 6f && num5 < (float)h - 6f && num13 >= 4 && num13 < 6) { ((Color)(ref val4))..ctor(0.32f, 0.56f, 0.88f); } } else { ((Color)(ref val4))..ctor(0.92f, 0.95f, 0.99f); } array[num12] = val4; array[num12].a = num11; } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private void EnsureResources() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown if (!_ready) { _ready = true; _texFelt = GenCircle(128, new Color(0.19f, 0.5f, 0.31f), new Color(0.06f, 0.22f, 0.14f)); _texRounded = GenRounded(32, 32, 8f, Color.white, Color.white, 0f); _texPill = GenRounded(48, 24, 12f, Color.white, Color.white, 0f); _texCircle = GenCircle(64, Color.white, new Color(0.72f, 0.72f, 0.72f)); _texCardFace = GenRounded(40, 56, 5f, new Color(0.99f, 0.99f, 0.985f), new Color(0.62f, 0.62f, 0.64f), 1.4f); _texCardBack = GenCardBack(44, 60); _texWhite = Texture2D.whiteTexture; _txt = new GUIStyle(); _txt.font = _font; _btnPill = new GUIStyle(GUI.skin.button); _btnPill.normal.background = _texPill; _btnPill.hover.background = _texPill; _btnPill.active.background = _texPill; _btnPill.focused.background = _texPill; _btnPill.onNormal.background = _texPill; _btnPill.onHover.background = _texPill; _btnPill.onActive.background = _texPill; _btnPill.onFocused.background = _texPill; _btnPill.border = new RectOffset(12, 12, 12, 12); _btnPill.font = _font; _btnPill.fontSize = 17; _btnPill.alignment = (TextAnchor)4; _btnPill.normal.textColor = Color.white; _btnPill.hover.textColor = new Color(1f, 0.96f, 0.8f); _btnPill.active.textColor = new Color(0.9f, 0.9f, 0.9f); _btnPill.focused.textColor = Color.white; _btnClear = new GUIStyle(); _btnClear.normal.background = null; _btnClear.hover.background = null; _btnClear.active.background = null; _btnClear.focused.background = null; _btnClear.onNormal.background = null; _btnClear.onHover.background = null; _btnClear.onActive.background = null; } } private void Text(Rect r, string s, int size, Color color, TextAnchor anchor) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) _txt.fontSize = size; _txt.normal.textColor = color; _txt.alignment = anchor; _txt.fontStyle = (FontStyle)0; GUI.Label(r, s, _txt); } private void TextBold(Rect r, string s, int size, Color color, TextAnchor anchor) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) _txt.fontSize = size; _txt.normal.textColor = color; _txt.alignment = anchor; _txt.fontStyle = (FontStyle)1; GUI.Label(r, s, _txt); _txt.fontStyle = (FontStyle)0; } private void Tinted(Rect r, Texture2D tex, Color tint) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = color * tint; GUI.DrawTexture(r, (Texture)(object)tex); GUI.color = color; } private bool PillButton(Rect r, string label, Color col, bool enabled, int fontSize) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; bool enabled2 = GUI.enabled; GUI.backgroundColor = (enabled ? col : BtnGray); GUI.enabled = enabled; _btnPill.fontSize = fontSize; bool num = GUI.Button(r, label, _btnPill); GUI.enabled = enabled2; GUI.backgroundColor = backgroundColor; return num && enabled; } public void Draw() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) EnsureResources(); ResetGuiState(); try { if (_open && _game != null) { _win = GUI.Window(3538, _win, new WindowFunction(DrawWindow), "", GUIStyle.none); } if (!string.IsNullOrEmpty(_toast)) { if (Time.realtimeSinceStartup < _toastUntil) { Rect r = default(Rect); ((Rect)(ref r))..ctor(((float)Screen.width - 560f) * 0.5f, (float)Screen.height - 100f, 560f, 34f); Tinted(r, _texRounded, new Color(0f, 0f, 0f, 0.72f)); Text(r, _toast, 15, new Color(1f, 0.95f, 0.85f), (TextAnchor)4); } else { _toast = ""; } } } finally { ResetGuiState(); } } private static void ResetGuiState() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) GUI.matrix = Matrix4x4.identity; GUI.color = Color.white; GUI.backgroundColor = Color.white; GUI.contentColor = Color.white; GUI.enabled = true; } private void DrawWindow(int id) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) DDZGame game = _game; float width = ((Rect)(ref _win)).width; float height = ((Rect)(ref _win)).height; GUI.DrawTexture(new Rect(0f, 0f, width, height), (Texture)(object)_texFelt); Tinted(new Rect(0f, 0f, width, 10f), _texWhite, new Color(0.38f, 0.24f, 0.12f)); Tinted(new Rect(0f, height - 10f, width, 10f), _texWhite, new Color(0.3f, 0.19f, 0.1f)); Tinted(new Rect(0f, 0f, 10f, height), _texWhite, new Color(0.34f, 0.22f, 0.11f)); Tinted(new Rect(width - 10f, 0f, 10f, height), _texWhite, new Color(0.34f, 0.22f, 0.11f)); DrawTopBar(game, width); DrawBottomCards(game, width); DrawMultiplierBadge(game, width); DrawAiSeat(game, 1, new Vector2(92f, 176f)); DrawAiSeat(game, 2, new Vector2(width - 92f, 176f)); if (game.Phase != Phase.Bidding) { DrawTableZone(game, 1, new Rect(196f, 236f, 330f, 158f)); DrawTableZone(game, 2, new Rect(width - 196f - 330f, 236f, 330f, 158f)); DrawTableZone(game, 0, new Rect((width - 330f) * 0.5f, 388f, 330f, 100f)); } else { for (int i = 0; i < 3; i++) { _tableCombo[i] = null; } DrawBiddingBubbles(game); } DrawLogStrip(game, new Rect(width - 262f, 404f, 238f, 128f)); DrawActionRow(game, width); DrawHumanHand(game, width, height); DrawHumanAvatar(game); if (game.Phase == Phase.Settled) { DrawSettled(game, width, height); } if (_flipConfirm) { DrawFlipConfirm(game, width, height); } GUI.DragWindow(new Rect(0f, 0f, width - 60f, 40f)); } private void DrawTopBar(DDZGame g, float W) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) Rect r = default(Rect); ((Rect)(ref r))..ctor(0f, 0f, W, 52f); Tinted(r, _texWhite, new Color(0f, 0f, 0f, 0.35f)); TextBold(new Rect(18f, 4f, 420f, 26f), "欢乐斗地主 · 讨伐黑雾", 19, Gold, (TextAnchor)0); Text(new Rect(18f, 28f, 640f, 20f), StakeText(g), 12, new Color(0.92f, 0.95f, 0.92f, 0.95f), (TextAnchor)0); string text = ((g.Phase == Phase.Bidding) ? "叫分" : ((g.Phase != Phase.Playing) ? "结算" : "出牌")); string text2 = ((g.Phase == Phase.Settled) ? "-" : SeatName(g, g.CurrentSeat)); string text3 = ""; ThreatGuard guard = _plugin.Guard; if (guard != null && guard.Active) { text3 = $" · 威胁度守卫 {guard.Remaining:0}s"; } Text(new Rect(W - 500f, 6f, 420f, 20f), $"第{_round}局/3 · 阶段:{text} · 轮到:{text2} · 倍数 x{g.Multiplier}{text3}", 13, new Color(0.95f, 0.95f, 0.9f), (TextAnchor)2); Text(new Rect(W - 500f, 28f, 420f, 18f), "左Alt+P 开关窗口", 11, new Color(0.85f, 0.88f, 0.85f, 0.7f), (TextAnchor)2); if (g.Phase != Phase.Settled && PillButton(new Rect(W * 0.5f - 62f, 9f, 124f, 32f), "掀 桌", BtnOrange, !_flipConfirm, 15)) { _flipConfirm = true; } if (PillButton(new Rect(W - 56f, 8f, 44f, 28f), "✕", BtnRed, enabled: true, 15)) { Close(); } } private string StakeText(DDZGame g) { string arg = "?"; try { PlanetData localPlanet = GameMain.localPlanet; if (localPlanet != null) { arg = localPlanet.displayName; } } catch (Exception) { } string text = ((g.Phase == Phase.Settled && g.HumanWon) ? ((!_awaitNextRound) ? "三局全胜!建筑 / 小兵 / 中继站已全部清除(太空威胁度 +0)" : ($"第{_round}局胜利:" + _wipeResult)) : ((g.Phase != Phase.Settled) ? RoundStakeText(_round) : "败局:机甲将被摧毁(玩家建筑保留)")); if (g.RedealCount > 0) { text += $" · 第{g.RedealCount}次重发"; } return $"星球:{arg} · {text}"; } private string SeatName(DDZGame g, int seat) { if (seat < 0 || seat >= g.Seats.Length) { return "?"; } string text = g.Seats[seat].Name; if (g.LandlordSeat == seat) { text += "★地主"; } return text; } private void DrawBottomCards(DDZGame g, float W) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) float num = 52f; float num2 = 74f; float num3 = 8f; float num4 = 3f * num + 2f * num3; float num5 = (W - num4) * 0.5f; Text(new Rect(num5, 58f, num4, 16f), "底牌", 12, new Color(0.95f, 0.95f, 0.9f, 0.85f), (TextAnchor)4); Rect val = default(Rect); for (int i = 0; i < 3; i++) { ((Rect)(ref val))..ctor(num5 + (float)i * (num + num3), 76f, num, num2); if (g.BottomRevealed && g.BottomCards != null) { DrawCardFace(val, g.BottomCards[i]); } else { GUI.DrawTexture(val, (Texture)(object)_texCardBack); } } } private void DrawMultiplierBadge(DDZGame g, float W) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) float num = 74f; Rect r = default(Rect); ((Rect)(ref r))..ctor((W - num) * 0.5f, 168f, num, num); Tinted(r, _texCircle, new Color(0.16f, 0.42f, 0.72f)); Tinted(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).y + 3f, num - 6f, num - 6f), _texCircle, new Color(0.13f, 0.35f, 0.62f)); TextBold(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 10f, num, 30f), "x" + g.Multiplier, 22, Color.white, (TextAnchor)4); Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 44f, num, 18f), "倍数", 12, new Color(0.9f, 0.95f, 1f, 0.9f), (TextAnchor)4); } private void DrawAiSeat(DDZGame g, int seat, Vector2 center) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) PlayerState playerState = g.Seats[seat]; float num = 72f; Rect r = default(Rect); ((Rect)(ref r))..ctor(center.x - num * 0.5f, center.y - num * 0.5f, num, num); bool flag = g.CurrentSeat == seat && g.Phase != Phase.Settled; Tinted(r, _texCircle, SeatColors[seat]); if (flag) { Tinted(new Rect(((Rect)(ref r)).x - 4f, ((Rect)(ref r)).y - 4f, num + 8f, num + 8f), _texCircle, new Color(1f, 0.9f, 0.4f, 0.35f)); } TextBold(r, playerState.Name.Substring(playerState.Name.Length - 1, 1), 30, Color.white, (TextAnchor)4); Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(center.x - 70f, center.y + num * 0.5f + 4f, 140f, 20f); TextBold(r2, playerState.Name + (flag ? "(思考中…)" : ""), 13, flag ? Gold : Color.white, (TextAnchor)4); if (g.LandlordSeat >= 0) { bool flag2 = g.LandlordSeat == seat; Rect r3 = default(Rect); ((Rect)(ref r3))..ctor(((Rect)(ref r)).x + num - 20f, ((Rect)(ref r)).y - 8f, 26f, 26f); Tinted(r3, _texCircle, flag2 ? new Color(0.88f, 0.22f, 0.18f) : new Color(0.22f, 0.52f, 0.88f)); TextBold(r3, flag2 ? "地" : "农", 14, Color.white, (TextAnchor)4); } int count = playerState.Hand.Count; if (count > 0) { float num2 = 30f; float num3 = 42f; float num4 = ((count > 1) ? Mathf.Min(11f, 170f / (float)(count - 1)) : 0f); float num5 = num2 + num4 * (float)(count - 1); float num6 = center.x - num5 * 0.5f; num6 = Mathf.Clamp(num6, 16f, ((Rect)(ref _win)).width - 16f - num5); float num7 = center.y + num * 0.5f + 28f; Rect r4 = default(Rect); ((Rect)(ref r4))..ctor(center.x - 70f, num7 + num3 + 4f, 140f, 18f); for (int i = 0; i < count; i++) { GUI.DrawTexture(new Rect(num6 + (float)i * num4, num7, num2, num3), (Texture)(object)_texCardBack); } Text(r4, "剩 " + count + " 张", 12, new Color(0.95f, 0.95f, 0.9f, 0.9f), (TextAnchor)4); } } private void DrawHumanAvatar(DDZGame g) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) _ = g.Seats[0]; float num = 64f; Rect r = default(Rect); ((Rect)(ref r))..ctor(20f, ((Rect)(ref _win)).height - num - 26f, num, num); bool flag = g.CurrentSeat == 0 && g.Phase != Phase.Settled; Tinted(r, _texCircle, SeatColors[0]); if (flag) { Tinted(new Rect(((Rect)(ref r)).x - 4f, ((Rect)(ref r)).y - 4f, num + 8f, num + 8f), _texCircle, new Color(1f, 0.9f, 0.4f, 0.35f)); } TextBold(r, "你", 26, Color.white, (TextAnchor)4); Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x + num + 6f, ((Rect)(ref r)).y + 10f, 120f, 20f); TextBold(r2, "你(人类)" + (flag ? " ← 轮到你" : ""), 13, flag ? Gold : Color.white, (TextAnchor)0); if (g.LandlordSeat >= 0) { bool flag2 = g.LandlordSeat == 0; Rect r3 = default(Rect); ((Rect)(ref r3))..ctor(((Rect)(ref r)).x + num - 18f, ((Rect)(ref r)).y - 8f, 26f, 26f); Tinted(r3, _texCircle, flag2 ? new Color(0.88f, 0.22f, 0.18f) : new Color(0.22f, 0.52f, 0.88f)); TextBold(r3, flag2 ? "地" : "农", 14, Color.white, (TextAnchor)4); } } private void DrawBiddingBubbles(DDZGame g) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) Vector2[] array = (Vector2[])(object)new Vector2[3] { new Vector2(52f, ((Rect)(ref _win)).height - 58f), new Vector2(92f, 176f), new Vector2(((Rect)(ref _win)).width - 92f, 176f) }; Rect r = default(Rect); for (int i = 0; i < 3; i++) { int num = g.Bids[i]; if (num >= 0) { Vector2 val = array[i]; ((Rect)(ref r))..ctor(val.x - 34f, val.y - 66f, 68f, 30f); Tinted(r, _texRounded, new Color(1f, 0.98f, 0.92f, 0.95f)); TextBold(r, (num == 0) ? "不叫" : (num + " 分"), 14, (num == 0) ? new Color(0.4f, 0.4f, 0.45f) : new Color(0.75f, 0.25f, 0.15f), (TextAnchor)4); } } if (!g.HumanCanAct) { Rect r2 = default(Rect); ((Rect)(ref r2))..ctor((((Rect)(ref _win)).width - 300f) * 0.5f, 300f, 300f, 26f); Text(r2, "等待其他玩家叫分…", 15, new Color(1f, 0.97f, 0.9f, 0.9f), (TextAnchor)4); } } private void DrawTableZone(DDZGame g, int seat, Rect zone) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) Combo combo = _tableCombo[seat]; if (g.LastPlay != null && g.LastPlaySeat == seat && g.LastPlay != combo) { _tableCombo[seat] = g.LastPlay; combo = _tableCombo[seat]; } if (g.Phase == Phase.Bidding) { combo = null; } if (combo != null) { int[] cards = combo.Cards; float num = 58f; float num2 = 82f; float num3 = ((cards.Length > 1) ? Mathf.Min(30f, (((Rect)(ref zone)).width - num) / (float)(cards.Length - 1)) : 0f); float num4 = num + num3 * (float)(cards.Length - 1); float num5 = ((Rect)(ref zone)).x + (((Rect)(ref zone)).width - num4) * 0.5f; float num6 = ((Rect)(ref zone)).y + (((Rect)(ref zone)).height - num2) * 0.5f; for (int i = 0; i < cards.Length; i++) { DrawCardFace(new Rect(num5 + (float)i * num3, num6, num, num2), cards[i]); } Text(new Rect(((Rect)(ref zone)).x, ((Rect)(ref zone)).y - 20f, ((Rect)(ref zone)).width, 18f), SeatName(g, seat) + ":" + combo.Describe(), 12, new Color(1f, 0.97f, 0.9f, 0.8f), (TextAnchor)4); } } private void DrawCardFace(Rect r, int id) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(r, (Texture)(object)_texCardFace); int num = DDZCards.RankOf(id); if (num >= 16) { Color color = ((num == 17) ? new Color(0.8f, 0.12f, 0.12f) : new Color(0.12f, 0.12f, 0.16f)); TextBold(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).y + 2f, ((Rect)(ref r)).width - 6f, ((Rect)(ref r)).height * 0.16f), (num == 17) ? "大" : "小", Mathf.Max(10, Mathf.RoundToInt(((Rect)(ref r)).height * 0.15f)), color, (TextAnchor)0); TextBold(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.22f, ((Rect)(ref r)).width, ((Rect)(ref r)).height * 0.48f), "王", Mathf.RoundToInt(((Rect)(ref r)).height * 0.4f), color, (TextAnchor)4); Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.7f, ((Rect)(ref r)).width, ((Rect)(ref r)).height * 0.2f), "★", Mathf.RoundToInt(((Rect)(ref r)).height * 0.17f), color, (TextAnchor)4); return; } Color color2 = (DDZCards.IsRed(id) ? CardRed : CardBlack); string s = DDZCards.RankName(num); string s2 = DDZCards.SuitSymbol(id); int num2 = Mathf.Max(11, Mathf.RoundToInt(((Rect)(ref r)).height * 0.19f)); float num3 = ((Rect)(ref r)).width - 6f; TextBold(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).y + 2f, num3, (float)num2 + 3f), s, num2, color2, (TextAnchor)0); Text(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).y + 2f + (float)num2, num3, (float)num2), s2, Mathf.RoundToInt((float)num2 * 0.82f), color2, (TextAnchor)0); Text(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width * 0.12f, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.22f, ((Rect)(ref r)).width * 0.76f, ((Rect)(ref r)).height * 0.56f), s2, Mathf.RoundToInt(((Rect)(ref r)).height * 0.46f), color2, (TextAnchor)4); Vector2 center = ((Rect)(ref r)).center; Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.TRS(Vector2.op_Implicit(center), Quaternion.Euler(0f, 0f, 180f), Vector3.one) * Matrix4x4.TRS(new Vector3(0f - center.x, 0f - center.y, 0f), Quaternion.identity, Vector3.one) * matrix; try { TextBold(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).y + 2f, num3, (float)num2 + 3f), s, num2, color2, (TextAnchor)0); Text(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).y + 2f + (float)num2, num3, (float)num2), s2, Mathf.RoundToInt((float)num2 * 0.82f), color2, (TextAnchor)0); } finally { GUI.matrix = matrix; } } private void DrawActionRow(DDZGame g, float W) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) if (g.Phase == Phase.Settled) { return; } float num = 42f; float num2 = 496f; bool humanCanAct = g.HumanCanAct; if (g.Phase == Phase.Bidding) { float num3 = 104f; float num4 = 14f; float num5 = (W - (num3 * 4f + num4 * 3f)) * 0.5f; if (PillButton(new Rect(num5, num2, num3, num), "不叫", BtnGray, humanCanAct, 17) && !g.SubmitBid(0, 0)) { ShowToast("无法不叫"); } for (int i = 1; i <= 3; i++) { bool enabled = humanCanAct && i > g.BidScore; if (PillButton(new Rect(num5 + (float)i * (num3 + num4), num2, num3, num), i + " 分", BtnBlue, enabled, 17) && !g.SubmitBid(0, i)) { ShowToast("叫分无效"); } } return; } float num6 = 118f; float num7 = 18f; float num8 = (W - (num6 * 3f + num7 * 2f)) * 0.5f; if (PillButton(new Rect(num8, num2, num6, num), "\ud83d\udca1 提示", BtnOrange, humanCanAct, 17)) { int[] array = g.HintCards(0); if (array == null || array.Length == 0) { _selected.Clear(); ShowToast("没有能压住的牌,建议不出"); } else { _selected.Clear(); for (int j = 0; j < array.Length; j++) { _selected.Add(array[j]); } } } if (PillButton(new Rect(num8 + num6 + num7, num2, num6, num), "不出", BtnGreen, humanCanAct && g.LastPlay != null, 17)) { if (!g.SubmitPass(0)) { ShowToast("当前不能不出"); } _selected.Clear(); } string label = ((_selected.Count == 0) ? "出 牌" : ("出 牌 (" + _selected.Count + ")")); if (PillButton(new Rect(num8 + (num6 + num7) * 2f, num2, num6, num), label, BtnBlue, humanCanAct && _selected.Count > 0, 17)) { int[] array2 = new int[_selected.Count]; _selected.CopyTo(array2); if (g.SubmitPlay(0, array2)) { _selected.Clear(); } else { ShowToast("牌型不合法或压不过上一手"); } } string text = SelectedText(g); if (!string.IsNullOrEmpty(text)) { Rect r = default(Rect); ((Rect)(ref r))..ctor((W - 520f) * 0.5f, num2 - 24f, 520f, 20f); Text(r, text, 13, Color.white, (TextAnchor)4); } } private string SelectedText(DDZGame g) { if (_selected.Count == 0) { return ""; } List<int> list = new List<int>(_selected); list.Sort(CompareCardDesc); Combo combo = Combo.Parse(list); if (combo == null) { return "已选 " + _selected.Count + " 张(不是合法牌型)"; } bool flag = g.LastPlay == null || combo.CanBeat(g.LastPlay); return "已选: " + combo.Describe() + (flag ? " ✓可出" : " ✗压不上"); } private static int CompareCardDesc(int a, int b) { int num = DDZCards.RankOf(b) - DDZCards.RankOf(a); if (num == 0) { return a - b; } return num; } private void DrawHumanHand(DDZGame g, float W, float H) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) List<int> list = new List<int>(g.Seats[0].Hand); list.Sort(CompareCardDesc); int count = list.Count; if (count == 0) { return; } float num = 88f; float num2 = 124f; float num3 = W - 260f; float num4 = ((count > 1) ? Mathf.Min(46f, (num3 - num) / (float)(count - 1)) : 0f); float num5 = num + num4 * (float)(count - 1); float num6 = (W - num5) * 0.5f; float num7 = H - num2 - 18f; Rect r = default(Rect); for (int i = 0; i < count; i++) { int num8 = list[i]; bool flag = _selected.Contains(num8); ((Rect)(ref r))..ctor(num6 + (float)i * num4, num7 - (flag ? 20f : 0f), num, num2); DrawCardFace(r, num8); if (GUI.Button(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, num * 0.5f, num2), "", _btnClear)) { if (_selected.Contains(num8)) { _selected.Remove(num8); } else if (_selected.Count < 20) { _selected.Add(num8); } } } } private void DrawFlipConfirm(DDZGame g, float W, float H) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.65f); GUI.DrawTexture(new Rect(0f, 0f, W, H), (Texture)(object)_texWhite); GUI.color = color; float num = 520f; float num2 = 256f; Rect r = default(Rect); ((Rect)(ref r))..ctor((W - num) * 0.5f, (H - num2) * 0.5f - 30f, num, num2); Tinted(r, _texRounded, new Color(0.16f, 0.1f, 0.08f, 0.97f)); Tinted(new Rect(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + 2f, num - 4f, num2 - 4f), _texRounded, new Color(0.2f, 0.13f, 0.1f, 0.97f)); TextBold(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 24f, num, 46f), "掀 桌 ?", 34, new Color(1f, 0.45f, 0.3f), (TextAnchor)4); Text(new Rect(((Rect)(ref r)).x + 34f, ((Rect)(ref r)).y + 86f, num - 68f, 70f), "确定掀桌?后果自负!\n当前星球全部地面黑雾基地 + 全部太空黑雾巢穴\n威胁度将立刻拉满 100%,它们会疯狂集结兵力报复。", 15, Color.white, (TextAnchor)1); float num3 = 176f; if (PillButton(new Rect(((Rect)(ref r)).x + num * 0.5f - num3 - 14f, ((Rect)(ref r)).y + num2 - 66f, num3, 44f), "掀了!", BtnRed, enabled: true, 18)) { _flipConfirm = false; string text = ""; try { text = DarkFogBridge.EnrageDarkFog(GameMain.localPlanet?.factory); } catch (Exception arg) { DouDizhuPlugin.Log.LogError((object)$"[掀桌] 执行异常:{arg}"); } if (string.IsNullOrEmpty(text) || !text.StartsWith("0 座") || !text.Contains("0 个")) { ShowToast("已掀桌!" + text + "威胁度 100%,它们怒了!"); if (_game != null && _game.Log != null) { _game.Log.Add("你掀桌了!" + text + "威胁度拉满 100%!"); } } else { ShowToast("附近没有可掀的黑雾"); } } if (PillButton(new Rect(((Rect)(ref r)).x + num * 0.5f + 14f, ((Rect)(ref r)).y + num2 - 66f, num3, 44f), "算了", BtnGray, enabled: true, 17)) { _flipConfirm = false; } } private void DrawLogStrip(DDZGame g, Rect r) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) List<string> log = g.Log; Tinted(r, _texRounded, new Color(0f, 0f, 0f, 0.42f)); if (log != null && log.Count != 0) { int num = Mathf.Max(0, log.Count - 5); float num2 = 22f; Rect r2 = default(Rect); for (int i = num; i < log.Count; i++) { ((Rect)(ref r2))..ctor(((Rect)(ref r)).x + 8f, ((Rect)(ref r)).y + 6f + (float)(i - num) * num2, ((Rect)(ref r)).width - 14f, num2); Text(r2, log[i], 12, new Color(0.88f, 0.95f, 0.88f, 0.92f), (TextAnchor)0); } } } private void DrawSettled(DDZGame g, float W, float H) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.62f); GUI.DrawTexture(new Rect(0f, 0f, W, H), (Texture)(object)_texWhite); GUI.color = color; float num = 560f; float num2 = 320f; Rect r = default(Rect); ((Rect)(ref r))..ctor((W - num) * 0.5f, (H - num2) * 0.5f - 20f, num, num2); Tinted(r, _texRounded, new Color(0.1f, 0.16f, 0.12f, 0.97f)); Tinted(new Rect(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + 2f, num - 4f, num2 - 4f), _texRounded, new Color(0.13f, 0.22f, 0.16f, 0.97f)); if (g.HumanWon) { if (_awaitNextRound) { TextBold(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 22f, num, 56f), $"第 {_round} 局 胜 利 !", 38, Gold, (TextAnchor)4); string s = ((_round == 1) ? "本星球黑雾建筑已全部清除(小兵保留)—— 太空威胁度 +0" : ((_round == 2) ? "本星球黑雾小兵已全部清除 —— 太空威胁度 +0" : "本星系中继站已全部清除 —— 太空威胁度 +0")); Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 88f, num, 24f), s, 16, Color.white, (TextAnchor)4); if (!string.IsNullOrEmpty(_wipeResult)) { Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 116f, num, 22f), "战果: " + _wipeResult, 14, new Color(0.9f, 0.95f, 0.9f), (TextAnchor)4); } Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 142f, num, 22f), g.SettleText, 14, new Color(0.85f, 0.9f, 0.85f), (TextAnchor)4); Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 168f, num, 22f), "下一局:" + RoundStakeText(_round + 1), 13, new Color(1f, 0.8f, 0.5f), (TextAnchor)4); if (_sweeping) { Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 192f, num, 20f), "巡检清剿残留中…(激活休眠单位并补刀)", 12, new Color(0.75f, 0.9f, 0.75f), (TextAnchor)4); } Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x + (num - 300f) * 0.5f, ((Rect)(ref r)).y + num2 - 66f, 300f, 44f); if (PillButton(r2, $"进入第{_round + 1}局", BtnGreen, enabled: true, 18)) { StartRound(_round + 1); } } else { TextBold(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 22f, num, 56f), "大 获 全 胜 !", 40, Gold, (TextAnchor)4); for (int i = 0; i < _roundResults.Count && i < 3; i++) { Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 92f + (float)i * 26f, num, 24f), _roundResults[i], 15, Color.white, (TextAnchor)4); } Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 178f, num, 24f), "建筑 / 小兵 / 中继站 已全部清除 —— 太空威胁度 +0", 15, new Color(0.95f, 1f, 0.95f), (TextAnchor)4); Rect r3 = default(Rect); ((Rect)(ref r3))..ctor(((Rect)(ref r)).x + (num - 300f) * 0.5f, ((Rect)(ref r)).y + num2 - 66f, 300f, 44f); if (PillButton(r3, "领取全部战果,返回星球", BtnGreen, enabled: true, 18)) { Close(); } } } else { TextBold(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 22f, num, 56f), "你 输 了 …", 42, new Color(1f, 0.35f, 0.3f), (TextAnchor)4); Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 88f, num, 24f), "庄家笑纳赌注 —— 你的机甲即将解体(玩家建筑保留)", 16, Color.white, (TextAnchor)4); Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 116f, num, 22f), g.SettleText, 14, new Color(0.85f, 0.9f, 0.85f), (TextAnchor)4); if (_deathCountdown > 0f) { TextBold(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 146f, num, 30f), $"机甲解体倒计时:{_deathCountdown:0} 秒", 20, new Color(1f, 0.6f, 0.3f), (TextAnchor)4); } Rect r4 = default(Rect); ((Rect)(ref r4))..ctor(((Rect)(ref r)).x + (num - 240f) * 0.5f, ((Rect)(ref r)).y + num2 - 66f, 240f, 44f); if (PillButton(r4, "立即受死(任务失败)", BtnRed, enabled: true, 17)) { Close(); DarkFogBridge.KillPlayer(); } } } } [BepInPlugin("dspdoudizhu.deepseekwork", "斗地主讨伐黑雾", "2.2.0")] public class DouDizhuPlugin : BaseUnityPlugin { public const string GUID = "dspdoudizhu.deepseekwork"; public const string NAME = "斗地主讨伐黑雾"; public const string VERSION = "2.2.0"; internal static ManualLogSource Log; internal static DouDizhuPlugin Instance; internal ConfigEntry<float> CfgAiThink; internal ConfigEntry<float> CfgGuardSeconds; internal ConfigEntry<float> CfgDeathCountdown; private DDZUI _ui; private ThreatGuard _guard; private bool _loggedError; internal ThreatGuard Guard => _guard; private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; CfgAiThink = ((BaseUnityPlugin)this).Config.Bind<float>("General", "AiThinkSeconds", 0.9f, new ConfigDescription("斗地主 AI 每步思考延迟(秒)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>())); CfgGuardSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ThreatGuardSeconds", 25f, new ConfigDescription("胜利全灭后,威胁度/进化快照回写守卫的持续秒数", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 120f), Array.Empty<object>())); CfgDeathCountdown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DeathCountdownSeconds", 5f, new ConfigDescription("斗地主失败后,距离机甲摧毁的倒计时(秒)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); _guard = new ThreatGuard(CfgGuardSeconds.Value); _ui = new DDZUI(this); try { new Harmony("dspdoudizhu.deepseekwork").PatchAll(typeof(VFInputBlock)); Log.LogInfo((object)"[斗地主讨伐黑雾] VFInput 穿透屏蔽补丁已挂载"); } catch (Exception ex) { Log.LogWarning((object)("[斗地主讨伐黑雾] 穿透屏蔽补丁挂载失败(点击可能穿透 UI):" + ex.Message)); } Log.LogInfo((object)"[斗地主讨伐黑雾] v2.2.0 已加载:降落到有黑雾的星球后按 左Alt+P 开局(不暂停游戏)"); } private void Update() { VFInputBlock.BlockNow = _ui != null && _ui.IsOpen; try { _guard.Tick(); } catch (Exception ex) { LogErrorOnce(ex, "ThreatGuard.Tick"); } try { _ui.Tick(Time.deltaTime); } catch (Exception ex2) { LogErrorOnce(ex2, "DDZUI.Tick"); } try { if (Input.GetKeyDown((KeyCode)112) && Input.GetKey((KeyCode)308)) { string why; if (_ui.IsOpen) { _ui.Close(); } else if (!_ui.CanOpenHere(out why)) { _ui.ShowToast(why); } else { _ui.Open(); } } } catch (Exception) { } } private void OnGUI() { try { _ui.Draw(); } catch (Exception ex) { LogErrorOnce(ex, "DDZUI.Draw"); } } private void OnDestroy() { try { _ui.ForceCloseNoPause(); } catch (Exception) { } } private void LogErrorOnce(Exception ex, string where) { if (!_loggedError) { _loggedError = true; Log.LogError((object)string.Format("[{0}] {1} 异常:{2}", "斗地主讨伐黑雾", where, ex)); } } } [HarmonyPatch] internal static class VFInputBlock { internal static volatile bool BlockNow; [HarmonyPostfix] [HarmonyPatch(typeof(VFInput), "UpdateGameStates")] public static void AfterUpdateGameStates() { if (BlockNow) { VFInput.onGUI = true; VFInput.onGUIOperate = true; VFInput.inputing = true; VFInput.readyToBuild = false; VFInput.readyToPlant = false; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerController), "UpdateCommandState")] public static void AfterUpdateCommandState() { if (BlockNow) { VFInput.readyToBuild = false; VFInput.readyToPlant = false; } } } } namespace DouDizhuMod.Engine { public static class DDZAI { private sealed class Cand { public int[] Cards; public Combo Combo; public bool Nuke; } private static readonly Random Rand = new Random(); public static int ChooseBid(DDZGame game, int seat) { int[] array = DDZGame.Counts(game.Seats[seat].Hand); double num = 0.0; if (array[17] > 0) { num += 3.0; } if (array[16] > 0) { num += 2.0; } num += (double)array[15] * 1.5; for (int i = 3; i <= 15; i++) { if (array[i] >= 4) { num += 2.0; } } int num2 = 0; for (int j = 3; j <= 14; j++) { if (array[j] > 0) { num2++; } } if (num2 >= 5) { num += 1.0; } num += Rand.NextDouble() * 1.5; int num3 = ((num >= 9.0) ? 3 : ((num >= 7.0) ? 2 : ((num >= 4.0) ? 1 : 0))); if (game.RedealCount >= 3) { num3 = Math.Max(num3, 1); } if (num3 <= game.BidScore) { return 0; } return num3; } public static int[] ChoosePlay(DDZGame game, int seat) { List<int> hand = game.Seats[seat].Hand; int count = hand.Count; List<int[]> list = game.EnumeratePlays(seat); if (list == null || list.Count == 0) { return null; } foreach (int[] item in list) { if (item.Length == count) { return item; } } if (seat != game.LandlordSeat && game.LastPlay != null && game.LastPlaySeat != seat && game.LastPlaySeat != game.LandlordSeat) { return null; } List<Cand> list2 = new List<Cand>(list.Count); foreach (int[] item2 in list) { Combo combo = Combo.Parse(item2); if (combo != null) { Cand cand = new Cand(); cand.Cards = item2; cand.Combo = combo; cand.Nuke = combo.Type == ComboType.Bomb || combo.Type == ComboType.Rocket; list2.Add(cand); } } if (game.LastPlay != null) { Cand cand2 = null; foreach (Cand item3 in list2) { if (!item3.Nuke && (cand2 == null || FollowBetter(item3.Combo, cand2.Combo))) { cand2 = item3; } } if (cand2 != null && (!BreaksBomb(hand, cand2.Cards) || count <= 6)) { return cand2.Cards; } int num = EnemyMinHand(game, seat); Cand cand3 = null; foreach (Cand item4 in list2) { if (item4.Nuke && (cand3 == null || NukeRank(item4.Combo) < NukeRank(cand3.Combo))) { cand3 = item4; } } if (cand3 != null && (num <= 2 || count <= 4)) { return cand3.Cards; } return null; } Cand cand4 = null; double num2 = double.NegativeInfinity; foreach (Cand item5 in list2) { double num3 = ScoreFree(game, seat, item5); if (num3 > num2) { num2 = num3; cand4 = item5; } } return cand4?.Cards; } private static double ScoreFree(DDZGame game, int seat, Cand c) { Combo combo = c.Combo; List<int> hand = game.Seats[seat].Hand; double num = (double)(c.Cards.Length * 2) - AverageRank(combo); if (combo.Type == ComboType.Straight || combo.Type == ComboType.PairStraight || combo.Type == ComboType.Plane || combo.Type == ComboType.PlaneSingle || combo.Type == ComboType.PlanePair) { num += 2.0; } if (combo.MainRank >= 15) { num -= 5.0; } if (combo.Type == ComboType.Single && combo.MainRank >= 16) { num -= 3.0; } if (BreaksBomb(hand, c.Cards)) { num -= 6.0; } if (combo.Type == ComboType.Bomb) { num -= 8.0; } if (combo.Type == ComboType.Rocket) { num -= 12.0; } if (EnemyMinHand(game, seat) <= 2) { if (combo.Type == ComboType.Single) { num += (double)combo.MainRank * 0.5; } if (c.Nuke) { num += 6.0; } } if (hand.Count <= 4) { num += (double)(c.Cards.Length * 2); } return num + Rand.NextDouble() * 0.5; } private static bool FollowBetter(Combo a, Combo b) { if (a.MainRank != b.MainRank) { return a.MainRank < b.MainRank; } return a.Cards.Length < b.Cards.Length; } private static double AverageRank(Combo c) { double num = 0.0; for (int i = 0; i < c.Cards.Length; i++) { num += (double)DDZCards.RankOf(c.Cards[i]); } if (c.Cards.Length == 0) { return 0.0; } return num / (double)c.Cards.Length; } private static bool BreaksBomb(List<int> hand, int[] cards) { int[] array = DDZGame.Counts(hand); int[] array2 = new int[18]; for (int i = 0; i < cards.Length; i++) { array2[DDZCards.RankOf(cards[i])]++; } for (int j = 3; j <= 15; j++) { if (array[j] >= 4 && array2[j] > 0 && array2[j] < array[j]) { return true; } } return false; } private static int EnemyMinHand(DDZGame game, int seat) { int num = int.MaxValue; for (int i = 0; i < 3; i++) { if (i != seat && ((seat != game.LandlordSeat) ? (i == game.LandlordSeat) : (i != game.LandlordSeat))) { int count = game.Seats[i].Hand.Count; if (count < num) { num = count; } } } if (num != int.MaxValue) { return num; } return 20; } private static int NukeRank(Combo c) { if (c.Type != ComboType.Rocket) { return c.MainRank; } return 99; } } public static class DDZCards { public const int SJOKER_ID = 52; public const int BJOKER_ID = 53; public static int RankOf(int id) { switch (id) { default: return 0; case 53: return 17; case 52: return 16; case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: case 38: case 39: case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: case 50: case 51: return 3 + id % 13; } } public static int SuitIndex(int id) { if (id < 0 || id >= 52) { return -1; } return id / 13; } public static string SuitSymbol(int id) { return SuitIndex(id) switch { 0 => "♠", 1 => "♥", 2 => "♣", 3 => "♦", _ => "", }; } public static string RankName(int rank) { return rank switch { 3 => "3", 4 => "4", 5 => "5", 6 => "6", 7 => "7", 8 => "8", 9 => "9", 10 => "10", 11 => "J", 12 => "Q", 13 => "K", 14 => "A", 15 => "2", 16 => "小王", 17 => "大王", _ => "?", }; } public static string CardText(int id) { switch (id) { default: return "?"; case 52: case 53: return RankName(RankOf(id)); case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: case 38: case 39: case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: case 50: case 51: return SuitSymbol(id) + RankName(RankOf(id)); } } public static bool IsRed(int id) { switch (id) { case 53: return true; case 52: return false; default: { int num = SuitIndex(id); if (num != 1) { return num == 3; } return true; } } } public static int IdOf(int suitIndex, int rank) { if (suitIndex < 0 || suitIndex > 3 || rank < 3 || rank > 15) { return -1; } return suitIndex * 13 + (rank - 3); } } public enum ComboType { Single, Pair, Triple, TripleOne, TripleTwo, Straight, PairStraight, Plane, PlaneSingle, PlanePair, FourTwoSingle, FourTwoPair, Bomb, Rocket } public sealed class Combo { public ComboType Type; public int MainRank; public int Length; public int[] Cards; public static Combo Parse(IEnumerable<int> cards) { if (cards == null) { return null; } return ParseList(new List<int>(cards)); } internal static Combo ParseList(List<int> list) { if (list == null || list.Count == 0) { return null; } int count = list.Count; if (count > 20) { return null; } int[] array = new int[18]; foreach (int item in list) { if (item < 0 || item > 53) { return null; } array[DDZCards.RankOf(item)]++; } if (count == 2 && array[16] == 1 && array[17] == 1) { return Make(ComboType.Rocket, 17, 1, list); } switch (count) { case 1: return Make(ComboType.Single, RankOfMax(array, 1), 1, list); case 2: if (SameRank(array, 2)) { return Make(ComboType.Pair, FirstRank(array, 2), 1, list); } return null; case 3: if (SameRank(array, 3)) { return Make(ComboType.Triple, FirstRank(array, 3), 1, list); } return null; case 4: { int num2 = RankWithCount(array, 4); if (num2 > 0) { return Make(ComboType.Bomb, num2, 1, list); } int num3 = RankWithCount(array, 3); if (num3 > 0) { return Make(ComboType.TripleOne, num3, 1, list); } return null; } case 5: { int num = RankWithCount(array, 3); if (num > 0 && RankWithCount(array, 2) > 0) { return Make(ComboType.TripleTwo, num, 1, list); } Combo combo5 = TryStraight(array, count); if (combo5 != null) { return combo5; } return null; } default: { Combo combo = TryStraight(array, count); if (combo != null) { return combo; } Combo combo2 = TryPairStraight(array, count); if (combo2 != null) { return combo2; } Combo combo3 = TryFourTwo(array, count, list); if (combo3 != null) { return combo3; } Combo combo4 = TryPlane(array, count, list); if (combo4 != null) { return combo4; } return null; } } } private static Combo Make(ComboType type, int mainRank, int length, IList<int> cards) { Combo combo = new Combo(); combo.Type = type; combo.MainRank = mainRank; combo.Length = length; int[] array = new int[cards.Count]; for (int i = 0; i < cards.Count; i++) { array[i] = cards[i]; } combo.Cards = array; return combo; } private static int RankOfMax(int[] cnt, int minCount) { for (int num = 17; num >= 3; num--) { if (cnt[num] >= minCount) { return num; } } return 0; } private static int FirstRank(int[] cnt, int exactCount) { for (int i = 3; i <= 17; i++) { if (cnt[i] == exactCount) { return i; } } return 0; } private static bool SameRank(int[] cnt, int exactCount) { int num = 0; for (int i = 3; i <= 17; i++) { if (cnt[i] > 0) { num++; if (cnt[i] != exactCount) { return false; } } } return num == 1; } private static int RankWithCount(int[] cnt, int exact) { for (int i = 3; i <= 17; i++) { if (cnt[i] == exact) { return i; } } return 0; } private static Combo TryStraight(int[] cnt, int n) { if (n < 5) { return null; } for (int i = 3; i <= 17; i++) { if (cnt[i] > 1) { return null; } } int num = -1; int num2 = -1; for (int j = 3; j <= 17; j++) { if (cnt[j] == 1) { if (num < 0) { num = j; } num2 = j; } else if (cnt[j] > 1) { return null; } } if (num < 0) { return null; } if (num2 > 14) { return null; } if (num2 - num + 1 != n) { return null; } if (n < 5) { return null; } return Make(ComboType.Straight, num, n, FromCnt(cnt)); } private static Combo TryPairStraight(int[] cnt, int n) { if (n < 6 || n % 2 != 0) { return null; } int num = n / 2; if (num < 3) { return null; } int num2 = -1; int num3 = -1; for (int i = 3; i <= 17; i++) { if (cnt[i] == 2) { if (num2 < 0) { num2 = i; } num3 = i; } else if (cnt[i] != 0) { return null; } } if (num2 < 0) { return null; } if (num3 > 14) { return null; } if (num3 - num2 + 1 != num) { return null; } return Make(ComboType.PairStraight, num2, num, FromCnt(cnt)); } private static Combo TryFourTwo(int[] cnt, int n, List<int> list) { if (n != 6 && n != 8) { return null; } int num = RankWithCount(cnt, 4); if (num == 0) { return null; } if (n == 6) { int num2 = n - 4; int num3 = 0; for (int i = 3; i <= 17; i++) { if (i != num && cnt[i] > 0) { num3 += cnt[i]; } } if (num3 != num2) { return null; } return Make(ComboType.FourTwoSingle, num, 1, list); } int num4 = 0; for (int j = 3; j <= 17; j++) { if (j != num) { if (cnt[j] % 2 != 0) { return null; } num4 += cnt[j] / 2; } } if (num4 != 2) { return null; } return Make(ComboType.FourTwoPair, num, 1, list); } private static Combo TryPlane(int[] cnt, int n, List<int> list) { for (int num = 6; num >= 2; num--) { for (int i = 3; i + num - 1 <= 14; i++) { bool flag = true; for (int j = i; j <= i + num - 1; j++) { if (cnt[j] < 3) { flag = false; break; } } if (!flag) { continue; } int num2 = num * 3; int num3 = n - num2; if (num3 < 0) { continue; } int[] array = new int[18]; for (int k = 3; k <= 17; k++) { array[k] = cnt[k]; } for (int l = i; l <= i + num - 1; l++) { array[l] -= 3; } if (num3 == 0) { return Make(ComboType.Plane, i, num, list); } if (num3 == num) { int num4 = 0; for (int m = 3; m <= 17; m++) { num4 += array[m]; } if (num4 == num3) { return Make(ComboType.PlaneSingle, i, num, list); } } if (num3 != 2 * num) { continue; } int num5 = 0; bool flag2 = true; for (int num6 = 3; num6 <= 17; num6++) { if (array[num6] != 0) { if (array[num6] % 2 != 0) { flag2 = false; break; } num5 += array[num6] / 2; } } if (flag2 && num5 == num) { return Make(ComboType.PlanePair, i, num, list); } } } return null; } private static int[] FromCnt(int[] cnt) { List<int> list = new List<int>(); for (int i = 3; i <= 17; i++) { int num = cnt[i]; if (num <= 0) { continue; } switch (i) { case 16: list.Add(52); continue; case 17: list.Add(53); continue; } int num2 = 0; while (num2 < 4 && num > 0) { list.Add(DDZCards.IdOf(num2, i)); num2++; num--; } } return list.ToArray(); } public bool CanBeat(Combo prev) { if (prev == null) { return true; } if (Type == ComboType.Rocket) { return true; } if (prev.Type == ComboType.Rocket) { return false; } if (Type == ComboType.Bomb) { if (prev.Type == ComboType.Bomb) { return MainRank > prev.MainRank; } return true; } if (prev.Type == ComboType.Bomb) { return false; } if (Type != prev.Type) { return false; } if (Length != prev.Length) { return false; } return MainRank > prev.MainRank; } public string Describe() { return Type switch { ComboType.Single => "单张" + DDZCards.RankName(MainRank), ComboType.Pair => "对" + DDZCards.RankName(MainRank), ComboType.Triple => "三张" + DDZCards.RankName(MainRank), ComboType.TripleOne => "三带一", ComboType.TripleTwo => "三带二", ComboType.Straight => "顺子" + DDZCards.RankName(MainRank) + "-" + DDZCards.RankName(MainRank + Length - 1), ComboType.PairStraight => "连对(" + Length + "对)", ComboType.Plane => "飞机(" + Length + "组)", ComboType.PlaneSingle => "飞机带单翅(" + Length + "组)", ComboType.PlanePair => "飞机带对翅(" + Length + "组)", ComboType.FourTwoSingle => "四带二单", ComboType.FourTwoPair => "四带二对", ComboType.Bomb => "炸弹(" + DDZCards.RankName(MainRank) + ")", ComboType.Rocket => "王炸", _ => "?", }; } } public enum Phase { Bidding, Playing, Settled } public sealed class PlayerState { public int Seat; public string Name; public bool IsLandlord; public List<int> Hand = new List<int>();