Compare commits

..
123 changed files with 2246 additions and 813 deletions
-8
View File
@@ -5,10 +5,6 @@ common --ui_event_filters=-INFO
common --enable_bzlmod
# Bazel 9 removes native C++ rule symbols. Keep external repositories that still
# reference C++ rules building while upstream module metadata catches up.
common --incompatible_autoload_externally=+CcInfo,+JavaInfo,+ProtoInfo,+cc_binary,+cc_library,+cc_proto_library,+cc_test,+java_proto_library,+proto_library,+sh_test
# Use pre-built protoc binary instead of compiling from source
common --incompatible_enable_proto_toolchain_resolution
common --@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc=true
@@ -28,11 +24,7 @@ common --local_test_jobs=64
common --jobs=64
common --cxxopt="--std=c++23"
common --cxxopt="-Wno-unknown-warning-option"
common --cxxopt="-Wno-character-conversion"
common --cxxopt="-Wno-deprecated-non-prototype"
common --per_file_copt=src/test/cpp/.*@-Wno-sign-compare
common --per_file_copt=src/test/cpp/.*@-Wno-deprecated-enum-compare
common --host_cxxopt="--std=c++23"
common --javacopt="-Xlint:-options"
+1 -1
View File
@@ -1 +1 @@
9.1.1
8.5.1
+7 -2
View File
@@ -401,8 +401,13 @@ jobs:
echo "$SPARKLE_EDDSA_PRIVATE_KEY" > "$SPARKLE_PRIVATE_KEY_PATH"
chmod 600 "$SPARKLE_PRIVATE_KEY_PATH"
# Install dmgbuild (creates .DS_Store programmatically, no AppleScript needed)
pip3 install dmgbuild
# Install dmgbuild in an isolated venv. Homebrew Python rejects system
# installs under PEP 668, and mac_build_handler shells out to dmgbuild.
DMGBUILD_VENV="${{ env.EAGLE0_BUILD_DIR }}/dmgbuild-venv"
python3 -m venv "$DMGBUILD_VENV"
"$DMGBUILD_VENV/bin/python" -m pip install --upgrade pip
"$DMGBUILD_VENV/bin/python" -m pip install dmgbuild
export PATH="$DMGBUILD_VENV/bin:$PATH"
# Background image for styled DMG
BACKGROUND_PATH="$(pwd)/ci/mac/dmg/background.png"
+4
View File
@@ -56,6 +56,10 @@ with `gh pr create --body-file <path>` or `gh pr edit <number> --body-file <path
shell quoting for PR bodies; Codex's permission matching may treat that as a complex shell command instead of a clean
`gh pr` invocation, causing unnecessary approval prompts.
Write these temporary body files, and any other scratch files needed for commands, under a known writable location such
as `/private/tmp`, `$TMPDIR`, or the current repository workspace. Do not use protected paths that require additional
user permission just to create or edit temporary files.
---
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
-1
View File
@@ -1,6 +1,5 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@io_bazel_rules_go//go:def.bzl", "nogo")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
package(default_visibility = ["//visibility:public"])
+6 -41
View File
@@ -18,16 +18,8 @@ SLF4J_VERSION = "2.0.18"
#
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "aspect_rules_esbuild", version = "0.26.0")
bazel_dep(name = "aspect_rules_js", version = "3.2.1")
bazel_dep(name = "bazel_jar_jar", repo_name = "bazel_jar_jar", version = "0.1.15")
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "rules_dotnet", version = "0.21.5")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
bazel_dep(name = "rules_android", version = "0.7.3")
bazel_dep(name = "rules_nodejs", version = "6.7.4")
bazel_dep(name = "rules_pkg", version = "1.2.0")
bazel_dep(name = "rules_shell", version = "0.8.0")
#
# Language Support - Scala
@@ -39,18 +31,14 @@ scala_config = use_extension(
"@rules_scala//scala/extensions:config.bzl",
"scala_config",
)
scala_config.settings(scala_version = SCALA_VERSION)
scala_deps = use_extension(
"@rules_scala//scala/extensions:deps.bzl",
"scala_deps",
)
scala_deps.scala()
scala_deps.scalatest()
scala_deps.scala_proto()
#
@@ -93,7 +81,6 @@ llvm.sysroot(
label = "@linux_sysroot_arm64//sysroot",
targets = ["linux-aarch64"],
)
use_repo(llvm, "llvm_toolchain", "llvm_toolchain_linux", "llvm_toolchain_linux_arm64")
# Download the Linux sysroots (Ubuntu 24.04 Noble for C++23 support)
@@ -119,19 +106,15 @@ sysroot(
# Language Support - Go
#
bazel_dep(name = "rules_go", repo_name = "io_bazel_rules_go", version = "0.61.1")
bazel_dep(name = "gazelle", repo_name = "bazel_gazelle", version = "0.51.3")
bazel_dep(name = "rules_go", version = "0.61.1", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.51.3", repo_name = "bazel_gazelle")
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.25.11")
use_repo(go_sdk, "go_default_sdk")
go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_aws_aws_sdk_go_v2",
@@ -153,53 +136,42 @@ use_repo(
bazel_dep(name = "rules_rust", version = "0.70.0")
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(edition = "2021")
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
crate.from_cargo(
name = "map_generator_crates",
cargo_lockfile = "//src/main/rust/net/eagle0/eagle/map_generator:Cargo.lock",
manifests = ["//src/main/rust/net/eagle0/eagle/map_generator:Cargo.toml"],
)
use_repo(crate, "map_generator_crates")
#
# Platform Support - Apple/iOS
#
bazel_dep(name = "apple_support", repo_name = "build_bazel_apple_support", version = "2.2.0")
bazel_dep(name = "rules_apple", repo_name = "build_bazel_rules_apple", version = "4.5.3")
bazel_dep(name = "apple_support", version = "1.24.5", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_apple", version = "4.3.3", repo_name = "build_bazel_rules_apple")
# Register Apple CC toolchain for Objective-C compilation
apple_cc_configure = use_extension(
"@build_bazel_apple_support//crosstool:setup.bzl",
"apple_cc_configure_extension",
)
use_repo(apple_cc_configure, "local_config_apple_cc", "local_config_apple_cc_toolchains")
#
# Protocol Buffers & RPC
#
bazel_dep(name = "protobuf", repo_name = "com_google_protobuf", version = "33.6")
single_version_override(
module_name = "protobuf",
version = "33.6",
)
bazel_dep(name = "protobuf", version = "33.6", repo_name = "com_google_protobuf")
# Use pre-built protoc binaries instead of compiling from source.
# See: https://protobuf.dev/reference/cpp/cpp-generated/#invocation
prebuilt_protoc = use_extension("@com_google_protobuf//bazel/private:prebuilt_protoc_extension.bzl", "protoc")
use_repo(
prebuilt_protoc,
"prebuilt_protoc.linux_aarch_64",
@@ -223,8 +195,8 @@ bazel_dep(name = "grpc", version = "1.78.0")
# TODO: Remove this override once a fixed grpc version is published to BCR.
single_version_override(
module_name = "grpc",
patches = ["//third_party/patches:grpc_fix_python_version.patch"],
patch_strip = 1,
patches = ["//third_party/patches:grpc_fix_python_version.patch"],
version = "1.78.0",
)
@@ -286,7 +258,6 @@ oci.pull(
platforms = ["linux/amd64"],
tag = "3.21",
)
use_repo(oci, "alpine_linux", "alpine_linux_linux_amd64", "eclipse_temurin_25_jdk", "eclipse_temurin_25_jdk_linux_amd64", "eclipse_temurin_25_jre", "eclipse_temurin_25_jre_linux_amd64", "ubuntu_24_04", "ubuntu_24_04_linux_amd64", "ubuntu_24_04_linux_arm64_v8")
#
@@ -297,7 +268,6 @@ bazel_dep(name = "rules_java", version = "9.6.1")
bazel_dep(name = "rules_jvm_external", version = "6.10")
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
# Netty
@@ -392,21 +362,18 @@ maven.artifact(
group = "com.google.code.gson",
version = "2.14.0",
)
maven.artifact(
artifact = "error_prone_annotations",
force_version = True,
group = "com.google.errorprone",
version = "2.50.0",
)
maven.artifact(
artifact = "guava",
force_version = True,
group = "com.google.guava",
version = "33.6.0-android",
)
use_repo(maven, "maven", "unpinned_maven")
#
@@ -425,8 +392,6 @@ GTL_SHA = "1969c45dd76eac0dd87e9e2b65cffe358617f4fe1bcd203f72f427742537913a"
http_archive(
name = "gtl",
build_file_content = """
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
name = "gtl",
hdrs = glob(["include/gtl/*.hpp"]),
+1598 -501
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -1,3 +1,5 @@
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
#pkg_tar(
# name = "eagle_servers",
# strip_prefix = "/src/main/scala/net/eagle0",
+22
View File
@@ -15,6 +15,8 @@
"com.google.guava:failureaccess": 1582410452,
"com.google.guava:guava": 582798237,
"com.google.j2objc:j2objc-annotations": 2003271689,
"com.google.protobuf:protobuf-java": -1795397632,
"com.google.protobuf:protobuf-java-util": -1033086717,
"com.google.re2j:re2j": 1525409503,
"com.google.s2a.proto.v2:s2a-proto": 898932763,
"com.google.truth:truth": 1696781452,
@@ -98,6 +100,7 @@
"com.google.http-client:google-http-client-gson": -1055701869,
"com.google.j2objc:j2objc-annotations": -2074422376,
"com.google.protobuf:protobuf-java": -1065767575,
"com.google.protobuf:protobuf-java-util": 675279053,
"com.google.re2j:re2j": -461460138,
"com.google.s2a.proto.v2:s2a-proto": 1108303781,
"com.google.truth:truth": 1427899897,
@@ -275,6 +278,7 @@
"com.google.api.grpc:proto-google-common-protos:2.63.1": "com.google.api.grpc:proto-google-common-protos:2.64.1",
"com.google.guava:failureaccess:1.0.1": "com.google.guava:failureaccess:1.0.3",
"com.google.j2objc:j2objc-annotations:2.8": "com.google.j2objc:j2objc-annotations:3.1",
"com.google.protobuf:protobuf-java:4.27.2": "com.google.protobuf:protobuf-java:4.35.0",
"io.netty:netty-transport-native-unix-common:4.1.127.Final": "io.netty:netty-transport-native-unix-common:4.1.135.Final",
"io.opencensus:opencensus-api:0.31.0": "io.opencensus:opencensus-api:0.31.1",
"org.codehaus.mojo:animal-sniffer-annotations:1.26": "org.codehaus.mojo:animal-sniffer-annotations:1.27"
@@ -436,6 +440,12 @@
},
"version": "4.35.0"
},
"com.google.protobuf:protobuf-java-util": {
"shasums": {
"jar": "a2665294d3e4675482bde593df8283f8c965f0207785e8e9b223f790644f5b08"
},
"version": "4.27.2"
},
"com.google.re2j:re2j": {
"shasums": {
"jar": "7b52c72156dd7f98b3237a5b35c1d34fba381b21048c89208913ad80a45dfbd7"
@@ -1508,6 +1518,14 @@
"com.google.code.gson:gson",
"com.google.http-client:google-http-client"
],
"com.google.protobuf:protobuf-java-util": [
"com.google.code.findbugs:jsr305",
"com.google.code.gson:gson",
"com.google.errorprone:error_prone_annotations",
"com.google.guava:guava",
"com.google.j2objc:j2objc-annotations",
"com.google.protobuf:protobuf-java"
],
"com.google.s2a.proto.v2:s2a-proto": [
"io.grpc:grpc-protobuf",
"io.grpc:grpc-stub"
@@ -2421,6 +2439,9 @@
"com.google.protobuf",
"com.google.protobuf.compiler"
],
"com.google.protobuf:protobuf-java-util": [
"com.google.protobuf.util"
],
"com.google.re2j:re2j": [
"com.google.re2j"
],
@@ -4081,6 +4102,7 @@
"com.google.http-client:google-http-client-gson",
"com.google.j2objc:j2objc-annotations",
"com.google.protobuf:protobuf-java",
"com.google.protobuf:protobuf-java-util",
"com.google.re2j:re2j",
"com.google.s2a.proto.v2:s2a-proto",
"com.google.truth:truth",
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
# Abstract base class for score calculators
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_binary(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")
cc_library(
@@ -4,8 +4,6 @@
#include "MapLoader.hpp"
#include <stdexcept>
#include "src/main/cpp/net/eagle0/common/FilesystemUtils.hpp"
const std::string kShardokMapExtension = ".e0m";
@@ -16,18 +14,14 @@ auto LoadMap(const string& mapName) -> HexMapProto {
const byte_vector mapProtoBytes = byte_vector::FromPath(mapPath);
net::eagle0::shardok::common::HexMap mapProto{};
if (!mapProto.ParseFromArray(mapProtoBytes.data(), static_cast<int>(mapProtoBytes.size()))) {
throw std::runtime_error("Failed to parse map proto from " + mapPath);
}
mapProto.ParseFromArray(mapProtoBytes.data(), (int)mapProtoBytes.size());
return mapProto;
}
auto LoadMapFromBytes(const string& mapBytes) -> HexMapProto {
net::eagle0::shardok::common::HexMap mapProto{};
if (!mapProto.ParseFromString(mapBytes)) {
throw std::runtime_error("Failed to parse map proto from bytes");
}
mapProto.ParseFromString(mapBytes);
return mapProto;
}
@@ -27,7 +27,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\Bin\Debug\Assembly-CSharp-firstpass\</OutputPath>
<DefineConstants>UNITY_6000_4_10;UNITY_6000_4;UNITY_6000;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;UNITY_2022_1_OR_NEWER;UNITY_2022_2_OR_NEWER;UNITY_2022_3_OR_NEWER;UNITY_2023_1_OR_NEWER;UNITY_2023_2_OR_NEWER;UNITY_2023_3_OR_NEWER;UNITY_6000_0_OR_NEWER;UNITY_6000_1_OR_NEWER;UNITY_6000_2_OR_NEWER;UNITY_6000_3_OR_NEWER;UNITY_6000_4_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;UNITY_ANALYTICS;ENABLE_AR;ENABLE_AUDIO;ENABLE_AUDIO_SCRIPTABLE_PIPELINE;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_UNITY_CONSENT;ENABLE_UNITY_CLOUD_IDENTIFIERS;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_NATIVE_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_EDITOR_GAME_SERVICES;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_MARSHALLING_TESTS;ENABLE_VIDEO;ENABLE_NAVIGATION_OFFMESHLINK_TO_NAVMESHLINK;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_ACCESSIBILITY_SCREEN_READER;TEXTCORE_1_0_OR_NEWER;EDITOR_ONLY_NAVMESH_BUILDER_DEPRECATED;PLATFORM_STANDALONE_OSX;PLATFORM_STANDALONE;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_CLOUD_SERVICES_ENGINE_DIAGNOSTICS;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_SPATIALTRACKING;PLATFORM_HAS_CUSTOM_MUTEX;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;PLATFORM_SUPPORTS_SPLIT_GRAPHICS_JOBS;PLATFORM_REQUIRES_PATH_NORMALIZATION;ENABLE_MONO;NET_STANDARD_2_0;NET_STANDARD;NET_STANDARD_2_1;NETSTANDARD;NETSTANDARD2_1;ENABLE_PROFILER;ENABLE_PROFILER_ASSISTANT_INTEGRATION;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;TEXTCORE_FONT_ENGINE_1_5_OR_NEWER;TEXTCORE_TEXT_ENGINE_1_5_OR_NEWER;TEXTCORE_FONT_ENGINE_1_6_OR_NEWER;UNITY_POST_PROCESSING_STACK_V2;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<DefineConstants>UNITY_6000_4_10;UNITY_6000_4;UNITY_6000;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;UNITY_2022_1_OR_NEWER;UNITY_2022_2_OR_NEWER;UNITY_2022_3_OR_NEWER;UNITY_2023_1_OR_NEWER;UNITY_2023_2_OR_NEWER;UNITY_2023_3_OR_NEWER;UNITY_6000_0_OR_NEWER;UNITY_6000_1_OR_NEWER;UNITY_6000_2_OR_NEWER;UNITY_6000_3_OR_NEWER;UNITY_6000_4_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;UNITY_ANALYTICS;ENABLE_AR;ENABLE_AUDIO;ENABLE_AUDIO_SCRIPTABLE_PIPELINE;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_UNITY_CONSENT;ENABLE_UNITY_CLOUD_IDENTIFIERS;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_NATIVE_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_EDITOR_GAME_SERVICES;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_MARSHALLING_TESTS;ENABLE_VIDEO;ENABLE_NAVIGATION_OFFMESHLINK_TO_NAVMESHLINK;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_ACCESSIBILITY_SCREEN_READER;TEXTCORE_1_0_OR_NEWER;EDITOR_ONLY_NAVMESH_BUILDER_DEPRECATED;PLATFORM_STANDALONE_OSX;PLATFORM_STANDALONE;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_CLOUD_SERVICES_ENGINE_DIAGNOSTICS;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_SPATIALTRACKING;PLATFORM_HAS_CUSTOM_MUTEX;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;PLATFORM_SUPPORTS_SPLIT_GRAPHICS_JOBS;PLATFORM_REQUIRES_PATH_NORMALIZATION;ENABLE_MONO;NET_STANDARD_2_0;NET_STANDARD;NET_STANDARD_2_1;NETSTANDARD;NETSTANDARD2_1;ENABLE_PROFILER;ENABLE_PROFILER_ASSISTANT_INTEGRATION;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_INPUT_SYSTEM;TEXTCORE_FONT_ENGINE_1_5_OR_NEWER;TEXTCORE_TEXT_ENGINE_1_5_OR_NEWER;TEXTCORE_FONT_ENGINE_1_6_OR_NEWER;UNITY_POST_PROCESSING_STACK_V2;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169,0649</NoWarn>
@@ -1027,6 +1027,9 @@
<Reference Include="Unity.Profiling.Core">
<HintPath>/Users/dancrosby/CodingProjects/github/eagle0-unity-client/src/main/csharp/net/eagle0/clients/unity/eagle0/Library/ScriptAssemblies/Unity.Profiling.Core.dll</HintPath>
</Reference>
<Reference Include="Unity.InputSystem.ForUI">
<HintPath>/Users/dancrosby/CodingProjects/github/eagle0-unity-client/src/main/csharp/net/eagle0/clients/unity/eagle0/Library/ScriptAssemblies/Unity.InputSystem.ForUI.dll</HintPath>
</Reference>
<Reference Include="Unity.Timeline.Editor">
<HintPath>/Users/dancrosby/CodingProjects/github/eagle0-unity-client/src/main/csharp/net/eagle0/clients/unity/eagle0/Library/ScriptAssemblies/Unity.Timeline.Editor.dll</HintPath>
</Reference>
@@ -1060,6 +1063,9 @@
<Reference Include="Unity.Collections.Editor">
<HintPath>/Users/dancrosby/CodingProjects/github/eagle0-unity-client/src/main/csharp/net/eagle0/clients/unity/eagle0/Library/ScriptAssemblies/Unity.Collections.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.InputSystem">
<HintPath>/Users/dancrosby/CodingProjects/github/eagle0-unity-client/src/main/csharp/net/eagle0/clients/unity/eagle0/Library/ScriptAssemblies/Unity.InputSystem.dll</HintPath>
</Reference>
<Reference Include="Unity.Addressables.Editor">
<HintPath>/Users/dancrosby/CodingProjects/github/eagle0-unity-client/src/main/csharp/net/eagle0/clients/unity/eagle0/Library/ScriptAssemblies/Unity.Addressables.Editor.dll</HintPath>
</Reference>
@@ -24,34 +24,35 @@ public class MoveCamera : MonoBehaviour {
void Update() {
// Get the left mouse button
if (Input.GetMouseButtonDown(0)) {
if (GameInput.PrimaryPointerPressedThisFrame()) {
// Get mouse origin
mouseOrigin = Input.mousePosition;
mouseOrigin = GameInput.PointerPosition();
isRotating = true;
}
// Get the right mouse button
if (Input.GetMouseButtonDown(1)) {
if (GameInput.SecondaryPointerPressedThisFrame()) {
// Get mouse origin
mouseOrigin = Input.mousePosition;
mouseOrigin = GameInput.PointerPosition();
isPanning = true;
}
// Get the middle mouse button
if (Input.GetMouseButtonDown(2)) {
if (GameInput.MiddlePointerPressedThisFrame()) {
// Get mouse origin
mouseOrigin = Input.mousePosition;
mouseOrigin = GameInput.PointerPosition();
isZooming = true;
}
// Disable movements on button release
if (!Input.GetMouseButton(0)) isRotating = false;
if (!Input.GetMouseButton(1)) isPanning = false;
if (!Input.GetMouseButton(2)) isZooming = false;
if (!GameInput.PrimaryPointerPressed()) isRotating = false;
if (!GameInput.SecondaryPointerPressed()) isPanning = false;
if (!GameInput.MiddlePointerPressed()) isZooming = false;
// Rotate camera along X and Y axis
if (isRotating) {
Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - mouseOrigin);
Vector3 pos = Camera.main.ScreenToViewportPoint(
(Vector3)GameInput.PointerPosition() - mouseOrigin);
transform.RotateAround(transform.position, transform.right, -pos.y * turnSpeed);
transform.RotateAround(transform.position, Vector3.up, pos.x * turnSpeed);
@@ -59,7 +60,8 @@ public class MoveCamera : MonoBehaviour {
// Move the camera on it's XY plane
if (isPanning) {
Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - mouseOrigin);
Vector3 pos = Camera.main.ScreenToViewportPoint(
(Vector3)GameInput.PointerPosition() - mouseOrigin);
Vector3 move = new Vector3(pos.x * panSpeed, pos.y * panSpeed, 0);
transform.Translate(move, Space.Self);
@@ -67,10 +69,11 @@ public class MoveCamera : MonoBehaviour {
// Move the camera linearly along Z axis
if (isZooming) {
Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - mouseOrigin);
Vector3 pos = Camera.main.ScreenToViewportPoint(
(Vector3)GameInput.PointerPosition() - mouseOrigin);
Vector3 move = pos.y * zoomSpeed * transform.forward;
transform.Translate(move, Space.World);
}
}
}
}
@@ -68,12 +68,12 @@ namespace eagle {
}
private void HandleTouchInput() {
if (Input.touchCount == 2) {
Touch touch0 = Input.GetTouch(0);
Touch touch1 = Input.GetTouch(1);
if (GameInput.TouchCount() == 2) {
var touch0 = GameInput.GetTouch(0);
var touch1 = GameInput.GetTouch(1);
float currentDistance = Vector2.Distance(touch0.position, touch1.position);
Vector2 currentCenter = (touch0.position + touch1.position) / 2f;
float currentDistance = Vector2.Distance(touch0.Position, touch1.Position);
Vector2 currentCenter = (touch0.Position + touch1.Position) / 2f;
if (!_isPinching) {
_isPinching = true;
@@ -22,9 +22,9 @@ public class CtrPanel : MonoBehaviour {
void Update() {
if (panels.Count <= 0 || !isReady) return;
if (Input.GetKeyDown(KeyCode.LeftArrow)) {
if (GameInput.LeftArrowPressed()) {
Click_Prev();
} else if (Input.GetKeyDown(KeyCode.RightArrow)) {
} else if (GameInput.RightArrowPressed()) {
Click_Next();
}
}
@@ -53,23 +53,23 @@ public class MouseHandler : MonoBehaviour {
if (clickReceiver?.CanReceiveGridInput != true) { return; }
// Handle touch input for long-press detection
if (Input.touchCount > 0) {
Touch touch = Input.GetTouch(0);
if (GameInput.TouchCount() > 0) {
var touch = GameInput.GetTouch(0);
if (touch.phase == TouchPhase.Began) {
if (touch.Phase == TouchPhase.Began) {
// Touch started - begin tracking
var touchDownGridIndex = currentGridIndex(touch.position);
var touchDownGridIndex = currentGridIndex(touch.Position);
if (touchDownGridIndex.HasValue ||
!IsPointerOverBlockingUI(touch.fingerId, touch.position)) {
!IsPointerOverBlockingUI(touch.FingerId, touch.Position)) {
_touchDownTime = Time.time;
_touchDownPosition = touch.position;
_touchDownPosition = touch.Position;
_touchDownGridIndex = touchDownGridIndex;
_longPressTriggered = false;
}
} else if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary) {
} else if (touch.Phase == TouchPhase.Moved || touch.Phase == TouchPhase.Stationary) {
// Touch ongoing - check for long-press
if (_touchDownTime.HasValue && !_longPressTriggered) {
var moved = Vector2.Distance(touch.position, _touchDownPosition);
var moved = Vector2.Distance(touch.Position, _touchDownPosition);
if (moved > MovementTolerancePixels) {
// Finger moved too much, cancel long-press
_touchDownTime = null;
@@ -81,11 +81,14 @@ public class MouseHandler : MonoBehaviour {
}
}
}
} else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled) {
} else if (touch.Phase == TouchPhase.Ended || touch.Phase == TouchPhase.Canceled) {
// Touch ended
_touchDownTime = null;
_touchDownGridIndex = null;
}
} else {
_touchDownTime = null;
_touchDownGridIndex = null;
}
}
@@ -12110,17 +12110,39 @@ MonoBehaviour:
m_GameObject: {fileID: 1004000001}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
m_MoveRepeatDelay: 0.5
m_MoveRepeatRate: 0.1
m_XRTrackingOrigin: {fileID: 0}
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_PointAction: {fileID: 1054132383583890850, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_MoveAction: {fileID: 3710738434707379630, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_SubmitAction: {fileID: 2064916234097673511, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_CancelAction: {fileID: -1967631576421560919, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_LeftClickAction: {fileID: 8056856818456041789, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_MiddleClickAction: {fileID: 3279352641294131588, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_RightClickAction: {fileID: 3837173908680883260, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_ScrollWheelAction: {fileID: 4502412055082496612, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_TrackedDevicePositionAction: {fileID: 4754684134866288074, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_TrackedDeviceOrientationAction: {fileID: 1025543830046995696, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_DeselectOnBackgroundClick: 1
m_PointerBehavior: 0
m_CursorLockBehavior: 0
m_ScrollDeltaPerTick: 6
--- !u!81 &1004000005
AudioListener:
m_ObjectHideFlags: 0
@@ -1066,10 +1066,11 @@ namespace Shardok {
return true;
}
if (Input.touchCount == 0) { return false; }
int touchCount = GameInput.TouchCount();
if (touchCount == 0) { return false; }
for (int i = 0; i < Input.touchCount; i++) {
var phase = Input.GetTouch(i).phase;
for (int i = 0; i < touchCount; i++) {
var phase = GameInput.GetTouch(i).Phase;
if (phase != TouchPhase.Ended && phase != TouchPhase.Canceled) { return true; }
}
@@ -1475,54 +1476,22 @@ namespace Shardok {
}
void HandleButton() {
/* else if (Input.GetButtonUp("Lightning")) {
LightningButtonClicked();
}
else if (Input.GetButtonUp("Meteor")) {
StartMeteorButtonClicked();
}
else if (Input.GetButtonUp("Move")) {
SetDisplayActionsUIState(DisplayActionsUIState.standardState);
handleOverlaysForSelection();
}
else if (Input.GetButtonUp("Extinguish")) {
ExtinguishButtonClicked();
}
else if (Input.GetButtonUp("StartFire")) {
StartFireButtonClicked();
}*/
// if (Input.GetButton("Horizontal"))
//{
// float horizontalValue = Input.GetAxis("Horizontal");
// Vector3 v = mainCamera.transform.position;
// v.x -= horizontalValue;
// mainCamera.transform.position = v;
// }
// if (Input.GetButton("Vertical"))
//{
// float verticalValue = Input.GetAxis("Vertical");
// Vector3 v = mainCamera.transform.position;
// v.z -= verticalValue;
// mainCamera.transform.position = v;
// }
if (Input.GetButton("Zoom")) {
float zoomValue = Input.GetAxis("Zoom");
float zoomValue = GameInput.ShardokZoomAxis();
if (!Mathf.Approximately(a: zoomValue, b: 0f)) {
var transform1 = mainCamera.transform;
Vector3 v = transform1.position;
v.y += zoomValue;
transform1.position = v;
}
if (Input.GetButtonDown("Hex Coords")) { SetCoordsLabels(); }
if (Input.GetButtonUp("Hex Coords")) { SetHeroLabels(); }
if (GameInput.HexCoordsPressed()) { SetCoordsLabels(); }
if (GameInput.HexCoordsReleased()) { SetHeroLabels(); }
if (Input.GetButtonDown("Profession Attack")) {
if (GameInput.ProfessionAttackPressed()) {
var prev = _displayedCommandGroup;
SetDisplayedCommandGroup(CommandTypeUIManager.ProfessionAttackGroup);
_previouslyDisplayedCommandGroup = prev;
}
if (Input.GetButtonUp("Profession Attack")) {
if (GameInput.ProfessionAttackReleased()) {
SetDisplayedCommandGroup(_previouslyDisplayedCommandGroup ?? 0);
}
}
@@ -11,20 +11,20 @@ public class TouchHandler : MonoBehaviour {
const float LONG_TOUCH_SECONDS = 2.0f;
// Use this for initialization
void Start() { Input.simulateMouseWithTouches = false; }
void Start() { GameInput.DisableMouseSimulationWithTouches(); }
// Update is called once per frame
void Update() {
if (gameController.hexGrid == null) { return; }
int numFingersDown = Input.touchCount;
int numFingersDown = GameInput.TouchCount();
if (numFingersDown > 0) {
Touch firstFingerTouch = Input.GetTouch(0);
var firstFingerTouch = GameInput.GetTouch(0);
if (EventSystem.current.IsPointerOverGameObject(firstFingerTouch.fingerId)) { return; }
if (EventSystem.current.IsPointerOverGameObject(firstFingerTouch.FingerId)) { return; }
Ray firstFingerInputRay = Camera.main.ScreenPointToRay(firstFingerTouch.position);
Ray firstFingerInputRay = Camera.main.ScreenPointToRay(firstFingerTouch.Position);
RaycastHit firstFingerHit;
if (Physics.Raycast(firstFingerInputRay, out firstFingerHit)) {
int? firstFingerGridIndex =
@@ -1,3 +1,4 @@
using System;
using UnityEngine;
#if ENABLE_INPUT_SYSTEM
@@ -5,6 +6,20 @@ using UnityEngine.InputSystem;
#endif
public static class GameInput {
public struct GameTouch {
public int FingerId;
public Vector2 Position;
public UnityEngine.TouchPhase Phase;
public GameTouch(int fingerId, Vector2 position, UnityEngine.TouchPhase phase) {
FingerId = fingerId;
Position = position;
Phase = phase;
}
}
private const float MouseScrollUnit = 120f;
public static Vector2 PointerPosition() {
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.mousePosition;
@@ -32,6 +47,18 @@ public static class GameInput {
#endif
}
public static bool PrimaryPointerPressedThisFrame() {
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetMouseButtonDown(0);
#else
#if ENABLE_INPUT_SYSTEM
if (Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame) { return true; }
#endif
return false;
#endif
}
public static bool SecondaryPointerPressed() {
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetMouseButton(1);
@@ -44,6 +71,44 @@ public static class GameInput {
#endif
}
public static bool SecondaryPointerPressedThisFrame() {
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetMouseButtonDown(1);
#else
#if ENABLE_INPUT_SYSTEM
if (Mouse.current != null && Mouse.current.rightButton.wasPressedThisFrame) { return true; }
#endif
return false;
#endif
}
public static bool MiddlePointerPressed() {
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetMouseButton(2);
#else
#if ENABLE_INPUT_SYSTEM
if (Mouse.current != null && Mouse.current.middleButton.isPressed) { return true; }
#endif
return false;
#endif
}
public static bool MiddlePointerPressedThisFrame() {
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetMouseButtonDown(2);
#else
#if ENABLE_INPUT_SYSTEM
if (Mouse.current != null && Mouse.current.middleButton.wasPressedThisFrame) {
return true;
}
#endif
return false;
#endif
}
public static bool CancelReleased() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && Keyboard.current.escapeKey.wasReleasedThisFrame) {
@@ -75,6 +140,34 @@ public static class GameInput {
#endif
}
public static bool LeftArrowPressed() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && Keyboard.current.leftArrowKey.wasPressedThisFrame) {
return true;
}
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetKeyDown(KeyCode.LeftArrow);
#else
return false;
#endif
}
public static bool RightArrowPressed() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && Keyboard.current.rightArrowKey.wasPressedThisFrame) {
return true;
}
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetKeyDown(KeyCode.RightArrow);
#else
return false;
#endif
}
public static bool ToggleDominionTableReleased() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && Keyboard.current.tKey.wasReleasedThisFrame) { return true; }
@@ -143,4 +236,158 @@ public static class GameInput {
return false;
#endif
}
public static float ShardokZoomAxis() {
#if ENABLE_INPUT_SYSTEM
float zoom = 0f;
if (Keyboard.current != null) {
if (Keyboard.current.sKey.isPressed) { zoom += 1f; }
if (Keyboard.current.wKey.isPressed) { zoom -= 1f; }
}
if (Mouse.current != null) {
float scrollY = Mouse.current.scroll.ReadValue().y;
if (!Mathf.Approximately(a: scrollY, b: 0f)) {
zoom += Mathf.Clamp(value: scrollY / MouseScrollUnit, min: -1f, max: 1f);
}
}
if (!Mathf.Approximately(a: zoom, b: 0f)) { return zoom; }
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetAxis("Zoom");
#else
return 0f;
#endif
}
public static bool HexCoordsPressed() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && Keyboard.current.cKey.wasPressedThisFrame) { return true; }
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetButtonDown("Hex Coords");
#else
return false;
#endif
}
public static bool HexCoordsReleased() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && Keyboard.current.cKey.wasReleasedThisFrame) { return true; }
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetButtonUp("Hex Coords");
#else
return false;
#endif
}
public static bool ProfessionAttackPressed() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && (Keyboard.current.leftCtrlKey.wasPressedThisFrame ||
Keyboard.current.rightCtrlKey.wasPressedThisFrame)) {
return true;
}
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetButtonDown("Profession Attack");
#else
return false;
#endif
}
public static bool ProfessionAttackReleased() {
#if ENABLE_INPUT_SYSTEM
if (Keyboard.current != null && (Keyboard.current.leftCtrlKey.wasReleasedThisFrame ||
Keyboard.current.rightCtrlKey.wasReleasedThisFrame)) {
return true;
}
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetButtonUp("Profession Attack");
#else
return false;
#endif
}
public static void DisableMouseSimulationWithTouches() {
#if ENABLE_LEGACY_INPUT_MANAGER
Input.simulateMouseWithTouches = false;
#endif
}
public static int TouchCount() {
#if ENABLE_LEGACY_INPUT_MANAGER
return Input.touchCount;
#else
#if ENABLE_INPUT_SYSTEM
if (Touchscreen.current == null) { return 0; }
int count = 0;
foreach (var touch in Touchscreen.current.touches) {
if (IsTrackedTouchPhase(touch.phase.ReadValue())) { count++; }
}
return count;
#else
return 0;
#endif
#endif
}
public static GameTouch GetTouch(int index) {
#if ENABLE_LEGACY_INPUT_MANAGER
UnityEngine.Touch touch = Input.GetTouch(index);
return new GameTouch(
fingerId: touch.fingerId,
position: touch.position,
phase: touch.phase);
#else
#if ENABLE_INPUT_SYSTEM
if (Touchscreen.current != null) {
int currentIndex = 0;
foreach (var touch in Touchscreen.current.touches) {
var phase = touch.phase.ReadValue();
if (!IsTrackedTouchPhase(phase)) { continue; }
if (currentIndex == index) {
return new GameTouch(
fingerId: touch.touchId.ReadValue(),
position: touch.position.ReadValue(),
phase: ToUnityTouchPhase(phase));
}
currentIndex++;
}
}
#endif
throw new ArgumentOutOfRangeException(
paramName: nameof(index),
message: $"No touch exists at index {index}");
#endif
}
#if ENABLE_INPUT_SYSTEM
private static bool IsTrackedTouchPhase(UnityEngine.InputSystem.TouchPhase phase) {
return phase != UnityEngine.InputSystem.TouchPhase.None;
}
private static UnityEngine.TouchPhase ToUnityTouchPhase(
UnityEngine.InputSystem.TouchPhase phase) {
switch (phase) {
case UnityEngine.InputSystem.TouchPhase.Began: return UnityEngine.TouchPhase.Began;
case UnityEngine.InputSystem.TouchPhase.Moved: return UnityEngine.TouchPhase.Moved;
case UnityEngine.InputSystem.TouchPhase.Ended: return UnityEngine.TouchPhase.Ended;
case UnityEngine.InputSystem.TouchPhase.Canceled:
return UnityEngine.TouchPhase.Canceled;
case UnityEngine.InputSystem.TouchPhase.Stationary:
return UnityEngine.TouchPhase.Stationary;
case UnityEngine.InputSystem.TouchPhase.None:
default: return UnityEngine.TouchPhase.Canceled;
}
}
#endif
}
@@ -0,0 +1,173 @@
#if ENABLE_INPUT_SYSTEM
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
using UnityEngine.SceneManagement;
public static class UIInputSystemModuleDefaultActions {
private static int configurationLogCount;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
private static void Initialize() {
ConfigureEditorInputBehavior();
InputSystem.onDeviceChange -= LogDeviceChange;
InputSystem.onDeviceChange += LogDeviceChange;
SceneManager.sceneLoaded -= AssignDefaultActionsToLoadedModules;
SceneManager.sceneLoaded += AssignDefaultActionsToLoadedModules;
AssignDefaultActionsToLoadedModules();
EnsureDiagnosticsRunner();
}
private static void ConfigureEditorInputBehavior() {
#if UNITY_EDITOR
InputSystem.settings.editorInputBehaviorInPlayMode =
InputSettings.EditorInputBehaviorInPlayMode.AllDeviceInputAlwaysGoesToGameView;
InputSystem.settings.backgroundBehavior = InputSettings.BackgroundBehavior.IgnoreFocus;
if (InputSystem.devices.Count == 0) {
InputSystem.AddDevice<Mouse>();
InputSystem.AddDevice<Keyboard>();
Debug.Log("[UIInputSystem] Added editor fallback Mouse and Keyboard devices.");
}
#endif
}
private static void LogDeviceChange(InputDevice device, InputDeviceChange change) {
Debug.Log(
"[UIInputSystem] Device change. " + $"change={change}, " +
$"device={device.displayName}, " + $"devices={DescribeDevices()}");
}
private static void AssignDefaultActionsToLoadedModules(Scene scene, LoadSceneMode mode) {
AssignDefaultActionsToLoadedModules();
}
private static void AssignDefaultActionsToLoadedModules() {
var modules = Object.FindObjectsByType<InputSystemUIInputModule>(FindObjectsSortMode.None);
foreach (InputSystemUIInputModule module in modules) {
if (!HasRequiredActions(module)) {
module.AssignDefaultActions();
module.enabled = false;
module.enabled = true;
}
}
if (EventSystem.current != null && EventSystem.current.currentInputModule == null) {
EventSystem.current.UpdateModules();
}
if (configurationLogCount < 8) {
configurationLogCount++;
Debug.Log(
"[UIInputSystem] Configured UI input modules. " +
$"moduleCount={modules.Length}, " +
$"eventSystem={(EventSystem.current == null ? "<none>" : EventSystem.current.name)}, " +
$"currentModule={DescribeCurrentModule()}, " +
$"devices={DescribeDevices()}, " +
$"moduleActions={string.Join(" | ", modules.Select(DescribeModuleActions))}");
}
}
private static bool HasRequiredActions(InputSystemUIInputModule module) {
return module.point?.action != null && module.leftClick?.action != null &&
module.submit?.action != null && module.cancel?.action != null;
}
private static void EnsureDiagnosticsRunner() {
if (Object.FindFirstObjectByType<UIInputSystemDiagnostics>() != null) { return; }
var gameObject = new GameObject("UI Input System Diagnostics");
Object.DontDestroyOnLoad(gameObject);
gameObject.AddComponent<UIInputSystemDiagnostics>();
}
private static string DescribeCurrentModule() {
if (EventSystem.current?.currentInputModule == null) { return "<none>"; }
var module = EventSystem.current.currentInputModule;
return $"{module.GetType().Name}({module.name}, active={module.isActiveAndEnabled})";
}
private static string DescribeDevices() {
return $"mouse={(Mouse.current == null ? "<none>" : Mouse.current.displayName)}, " +
$"touchscreen={(Touchscreen.current == null ? "<none>" : Touchscreen.current.displayName)}, " +
$"keyboard={(Keyboard.current == null ? "<none>" : Keyboard.current.displayName)}, " +
$"deviceCount={InputSystem.devices.Count}, " +
$"allDevices={string.Join(", ", InputSystem.devices.Select(device => device.displayName))}";
}
private static string DescribeModuleActions(InputSystemUIInputModule module) {
return $"{module.name}: " + $"active={module.isActiveAndEnabled}, " +
$"point={DescribeAction(module.point)}, " +
$"leftClick={DescribeAction(module.leftClick)}, " +
$"submit={DescribeAction(module.submit)}, " +
$"cancel={DescribeAction(module.cancel)}";
}
private static string DescribeAction(UnityEngine.InputSystem.InputActionReference reference) {
if (reference?.action == null) { return "<null>"; }
return $"{reference.action.name}(enabled={reference.action.enabled}, " +
$"phase={reference.action.phase})";
}
private class UIInputSystemDiagnostics : MonoBehaviour {
private void Update() {
if (!PointerPressedThisFrame()) { return; }
Vector2 pointerPosition = PointerPosition();
var raycastResults = RaycastPointer(pointerPosition);
var modules =
Object.FindObjectsByType<InputSystemUIInputModule>(FindObjectsSortMode.None);
string topHit =
raycastResults.Count == 0
? "<none>"
: $"{raycastResults[0].gameObject.name} " +
$"(module={raycastResults[0].module?.GetType().Name})";
Debug.Log(
"[UIInputSystem] Pointer click diagnostic. " + $"position={pointerPosition}, " +
$"eventSystem={(EventSystem.current == null ? "<none>" : EventSystem.current.name)}, " +
$"currentModule={DescribeCurrentModule()}, " +
$"moduleCount={modules.Length}, " + $"topRaycastHit={topHit}, " +
$"allRaycastHits={string.Join(", ", raycastResults.Select(r => r.gameObject.name).Take(8))}, " +
$"moduleActions={string.Join(" | ", modules.Select(DescribeModuleActions))}");
}
private static bool PointerPressedThisFrame() {
if (Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame) {
return true;
}
if (Touchscreen.current != null &&
Touchscreen.current.primaryTouch.press.wasPressedThisFrame) {
return true;
}
return GameInput.PrimaryPointerPressedThisFrame();
}
private static Vector2 PointerPosition() {
if (Mouse.current != null) { return Mouse.current.position.ReadValue(); }
if (Touchscreen.current != null) {
return Touchscreen.current.primaryTouch.position.ReadValue();
}
return GameInput.PointerPosition();
}
private static List<RaycastResult> RaycastPointer(Vector2 position) {
if (EventSystem.current == null) { return new List<RaycastResult>(); }
var pointerData = new PointerEventData(EventSystem.current) {
pointerId = -1,
position = position,
};
var results = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointerData, results);
return results;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0a7d6c2c7e3b4cc29875996ad7ba5952
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,3 +1,5 @@
load("//tools/rules_unity3d:unity3d.bzl", "unity3d_binary")
#unity3d_binary(
# name = "windows",
# build_command = "buildWindows64Player",
@@ -1,5 +1,4 @@
load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@flatbuffers//:build_defs.bzl", "DEFAULT_FLATC_ARGS", "flatbuffer_cc_library")
load("//tools:copts.bzl", "COPTS")
flatbuffer_cc_library(
@@ -1,5 +1,3 @@
load("@rules_java//java:defs.bzl", "java_binary")
java_binary(
name = "name_generation_lambda",
srcs = ["NameGenerationHandler.java"],
@@ -1,5 +1,4 @@
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_bundle")
load("@rules_cc//cc:defs.bzl", "objc_library")
# Native Sparkle plugin for Unity
# This plugin initializes Sparkle auto-updater at runtime
@@ -1,3 +1,5 @@
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
filegroup(
name = "settings",
srcs = ["settings.tsv"],
@@ -1,5 +1,4 @@
load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@flatbuffers//:build_defs.bzl", "DEFAULT_FLATC_ARGS", "flatbuffer_cc_library")
load("//tools:copts.bzl", "COPTS")
filegroup(
@@ -2,15 +2,13 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
def _convert_maps_impl(ctx):
all_input_files = [
f
for t in ctx.attr.targeted_filegroups
for f in t.files.to_list()
f for t in ctx.attr.targeted_filegroups for f in t.files.to_list()
]
all_outputs = []
for f in all_input_files:
out = ctx.actions.declare_file(paths.replace_extension(f.basename, ctx.attr.to_extension))
all_outputs.append(out)
all_outputs += [out]
ctx.actions.run(
mnemonic = "BuildMaps",
outputs = [out],
@@ -25,11 +23,11 @@ def _convert_maps_impl(ctx):
return [
DefaultInfo(
files = depset(all_outputs),
runfiles = ctx.runfiles(files = all_outputs),
),
files=depset(all_outputs),
runfiles=ctx.runfiles(files=all_outputs))
]
convert_maps = rule(
implementation = _convert_maps_impl,
attrs = {
@@ -39,6 +37,6 @@ convert_maps = rule(
default = Label("//src/main/go/net/eagle0/build/hex_map_json_converter"),
executable = True,
cfg = "exec",
),
)
},
)
)
@@ -1,7 +1,9 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
def _generate_map_info_impl(ctx):
all_outputs = []
out = ctx.actions.declare_file("map_info.json")
all_outputs.append(out)
all_outputs += [out]
ctx.actions.run(
mnemonic = "GenerateMapInfo",
outputs = [out],
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "name_generator",
@@ -0,0 +1 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "action_result_component_trait",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "changed_province",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "concrete",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "action_result_concrete",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "chronicle_event",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "eagle_map_info_converter",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "date",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "diplomacy_offer",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "chronicle_event",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "province",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "army",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "concrete",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "date",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "diplomacy_offer",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "status",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "concrete",
@@ -1,4 +1,4 @@
load("@rules_scala//scala:scala.bzl", "scala_library")
load("@rules_scala//scala:scala.bzl", "scala_binary", "scala_library")
scala_library(
name = "eagle_appears_action",
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,5 +1,4 @@
load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@rules_cc//cc:defs.bzl", "cc_test")
load("@flatbuffers//:build_defs.bzl", "DEFAULT_FLATC_ARGS", "flatbuffer_cc_library")
flatbuffer_cc_library(
name = "test_fbs",
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
# Mock game implementation for testing abstract MCTS
+1 -2
View File
@@ -1,5 +1,4 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
load("//tools:copts.bzl", "COPTS", "TEST_COPTS")
cc_test(
name = "map_info_calculator_test",
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("//tools:copts.bzl", "COPTS", "TEST_COPTS")
cc_library(
@@ -387,8 +387,7 @@ auto postWithResults(
}) -
commands.begin();
EXPECT_GE(index, 0);
EXPECT_LT(static_cast<size_t>(index), commands.size());
EXPECT_LT(index, commands.size());
return postWithResults(game, playerId, index);
}
@@ -408,8 +407,7 @@ auto postWithResults(
}) -
commands.begin();
EXPECT_GE(index, 0);
EXPECT_LT(static_cast<size_t>(index), commands.size());
EXPECT_LT(index, commands.size());
return postWithResults(game, playerId, index, std::move(generator));
}
@@ -193,8 +193,7 @@ TEST_F(ShardokEngineTests, StartGame_mageNotCasting_staysNotCasting) {
const UnitView unit1 = game->GetUnitById(0, 0);
EXPECT_EQ(
unit1.attached_hero().profession_info().meteor_cast_state(),
static_cast<decltype(unit1.attached_hero().profession_info().meteor_cast_state())>(
net::eagle0::shardok::storage::fb::MultiroundMagicState_NONE));
net::eagle0::shardok::storage::fb::MultiroundMagicState_NONE);
}
TEST_F(ShardokEngineTests, StartRound_mageStartingMeteor_incrementsToTarget) {
@@ -217,8 +216,7 @@ TEST_F(ShardokEngineTests, StartRound_mageStartingMeteor_incrementsToTarget) {
const UnitView unit1 = game->GetUnitById(0, 0);
EXPECT_EQ(
unit1.attached_hero().profession_info().meteor_cast_state(),
static_cast<decltype(unit1.attached_hero().profession_info().meteor_cast_state())>(
net::eagle0::shardok::storage::fb::MultiroundMagicState_TARGET));
net::eagle0::shardok::storage::fb::MultiroundMagicState_TARGET);
}
TEST_F(ShardokEngineTests, StartRound_mageTargetingMeteor_incrementsToCast) {
@@ -243,8 +241,7 @@ TEST_F(ShardokEngineTests, StartRound_mageTargetingMeteor_incrementsToCast) {
const UnitView unit1 = game->GetUnitById(0, 0);
EXPECT_EQ(
unit1.attached_hero().profession_info().meteor_cast_state(),
static_cast<decltype(unit1.attached_hero().profession_info().meteor_cast_state())>(
net::eagle0::shardok::storage::fb::MultiroundMagicState_CAST));
net::eagle0::shardok::storage::fb::MultiroundMagicState_CAST);
}
TEST_F(ShardokEngineTests, GetEligibleCharger_original_returnsAbsent) {
@@ -291,7 +288,7 @@ TEST_F(ShardokEngineTests, GetEligibleCharger_afterCharging_returnsAbsent) {
postCommandWithTypeAndTarget(game, 0, 0, MOVE_COMMAND, Coords(2, 1));
vector<ActionResultView> results;
results = postCommandWithTypeAndTarget(game, 0, 0, CHARGE_COMMAND, Coords(2, 0));
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
EXPECT_EQ(-1, game->GetCurrentGameState()->eligible_charger_id());
}
@@ -312,11 +309,11 @@ TEST_F(ShardokEngineTests, GetEligibleCharger_afterRestingHero_returnsAbsent) {
vector<ActionResultView> results;
results = postCommandWithTypeAndTarget(game, 0, 0, MOVE_COMMAND, Coords(2, 1));
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
EXPECT_NE(-1, game->GetCurrentGameState()->eligible_charger_id());
results = postCommandWithType(game, 0, 0, UNIT_REST_COMMAND);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
EXPECT_EQ(-1, game->GetCurrentGameState()->eligible_charger_id());
}
@@ -339,11 +336,11 @@ TEST_F(ShardokEngineTests, GetEligibleCharger_afterStoppingHero_returnsAbsent) {
vector<ActionResultView> results;
results = postCommandWithTypeAndTarget(game, 0, 0, MOVE_COMMAND, Coords(2, 1));
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
EXPECT_NE(-1, game->GetCurrentGameState()->eligible_charger_id());
results = postCommandWithType(game, 0, 0, UNIT_STOP_COMMAND);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
EXPECT_EQ(-1, game->GetCurrentGameState()->eligible_charger_id());
}
@@ -364,7 +361,7 @@ TEST_F(ShardokEngineTests, placeHero_placesHero) {
0,
PLACE_UNIT_COMMAND,
ATTACKER_STARTING_POSITIONS[0][0]);
EXPECT_EQ(1u, results.size());
EXPECT_EQ(1, results.size());
const ActionResultView result = results[0];
@@ -399,14 +396,14 @@ TEST_F(ShardokEngineTests, placeLastHero_switchesPlayer) {
0,
PLACE_UNIT_COMMAND,
ATTACKER_STARTING_POSITIONS[0][0]);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
results = postCommandWithTypeAndTarget(
game,
0,
1,
PLACE_UNIT_COMMAND,
ATTACKER_STARTING_POSITIONS[0][1]);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
// post the end setup command
postWithResults(game, 0, 0);
@@ -432,14 +429,14 @@ TEST_F(ShardokEngineTests, placeLastHeroBothPlayers_startsGame) {
0,
PLACE_UNIT_COMMAND,
ATTACKER_STARTING_POSITIONS[0][0]);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
results = postCommandWithTypeAndTarget(
game,
0,
1,
PLACE_UNIT_COMMAND,
ATTACKER_STARTING_POSITIONS[0][1]);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
// post the end setup command
postWithResults(game, 0, 0);
@@ -450,7 +447,7 @@ TEST_F(ShardokEngineTests, placeLastHeroBothPlayers_startsGame) {
2,
PLACE_UNIT_COMMAND,
DEFENDER_STARTING_POSITIONS[0]);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
// post the end setup command
results = postWithResults(game, 1, 0);
@@ -528,17 +525,11 @@ TEST_F(ShardokEngineTests, getUnitInfo_31Knowledge_mageNotFiltered) {
EXPECT_FALSE(shouldBeFiltered.has_volleys_remaining());
EXPECT_EQ(
static_cast<decltype(shouldBeFiltered.attached_hero().profession_info().profession())>(
GetUnitT1().mutable_attached_hero().mutable_profession_info().profession()),
GetUnitT1().mutable_attached_hero().mutable_profession_info().profession(),
shouldBeFiltered.attached_hero().profession_info().profession());
EXPECT_FALSE(shouldBeFiltered.attached_hero().profession_info().has_cast_target());
EXPECT_EQ(
static_cast<decltype(shouldBeFiltered.attached_hero()
.profession_info()
.meteor_cast_state())>(GetUnitT1()
.mutable_attached_hero()
.mutable_profession_info()
.meteor_cast_state()),
GetUnitT1().mutable_attached_hero().mutable_profession_info().meteor_cast_state(),
shouldBeFiltered.attached_hero().profession_info().meteor_cast_state());
}
@@ -558,17 +549,11 @@ TEST_F(ShardokEngineTests, getUnitInfo_51Knowledge_battalionStatsNotFiltered) {
GetUnitT1().mutable_attached_hero().eagle_hero_id());
EXPECT_FALSE(shouldBeFiltered.attached_hero().has_stats());
EXPECT_EQ(
static_cast<decltype(shouldBeFiltered.attached_hero().profession_info().profession())>(
GetUnitT1().mutable_attached_hero().mutable_profession_info().profession()),
GetUnitT1().mutable_attached_hero().mutable_profession_info().profession(),
shouldBeFiltered.attached_hero().profession_info().profession());
EXPECT_FALSE(shouldBeFiltered.attached_hero().profession_info().has_cast_target());
EXPECT_EQ(
static_cast<decltype(shouldBeFiltered.attached_hero()
.profession_info()
.meteor_cast_state())>(GetUnitT1()
.mutable_attached_hero()
.mutable_profession_info()
.meteor_cast_state()),
GetUnitT1().mutable_attached_hero().mutable_profession_info().meteor_cast_state(),
shouldBeFiltered.attached_hero().profession_info().meteor_cast_state());
EXPECT_EQ(
shouldBeFiltered.battalion().armament().value(),
@@ -628,17 +613,11 @@ TEST_F(ShardokEngineTests, getUnitInfo_76Knowledge_heroStatsNotFiltered) {
GetUnitT1().mutable_attached_hero().vigor());
EXPECT_EQ(
shouldBeFiltered.attached_hero().profession_info().profession(),
static_cast<decltype(shouldBeFiltered.attached_hero().profession_info().profession())>(
GetUnitT1().mutable_attached_hero().mutable_profession_info().profession()));
GetUnitT1().mutable_attached_hero().mutable_profession_info().profession());
EXPECT_FALSE(shouldBeFiltered.attached_hero().profession_info().has_cast_target());
EXPECT_EQ(
shouldBeFiltered.attached_hero().profession_info().meteor_cast_state(),
static_cast<decltype(shouldBeFiltered.attached_hero()
.profession_info()
.meteor_cast_state())>(GetUnitT1()
.mutable_attached_hero()
.mutable_profession_info()
.meteor_cast_state()));
GetUnitT1().mutable_attached_hero().mutable_profession_info().meteor_cast_state());
EXPECT_EQ(
shouldBeFiltered.battalion().armament().value(),
GetUnitT1().mutable_battalion().armament());
@@ -663,7 +642,7 @@ TEST_F(ShardokEngineTests, GetGameHistory_startMeteorLowKnowledge_filteredOut) {
const auto game = GameWithUnits(BASIC_MAP, attackerUnits, defenderUnits);
const auto results = postCommandWithType(game, 0, 0, METEOR_START_COMMAND);
EXPECT_NE(0u, results.size());
EXPECT_NE(0, results.size());
auto history = game->GetFilteredGameHistory(0);
EXPECT_CONTAINS_WHERE(history, [](const ActionResultView &result) {
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -158,7 +158,7 @@ TEST_F(PlayerSetupCommandFactoryTest, unplacedDefendingRanger_canHideInForest) {
CommandList commands{};
factory.AddAvailablePlayerSetupCommands(commands, 1, gameState);
EXPECT_EQ(36UL, commands.size());
EXPECT_EQ(6 * 6, commands.size());
for (int row = 0; row < 6; row++) {
for (int column = 0; column < 6; column++) {
@@ -187,7 +187,7 @@ TEST_F(PlayerSetupCommandFactoryTest, unplacedDefendingRanger_canHideInSwamp) {
CommandList commands{};
factory.AddAvailablePlayerSetupCommands(commands, 1, gameState);
EXPECT_EQ(36UL, commands.size());
EXPECT_EQ(6 * 6, commands.size());
for (int row = 0; row < 6; row++) {
for (int column = 0; column < 6; column++) {
@@ -221,5 +221,5 @@ TEST_F(PlayerSetupCommandFactoryTest, unplacedDefendingRanger_cannotHideOnOccupi
factory.AddAvailablePlayerSetupCommands(commands, 1, gameState);
// Can't place where the enemy is
EXPECT_EQ(35UL, commands.size());
EXPECT_EQ(6 * 6 - 1, commands.size());
}
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(
@@ -1,4 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//tools:copts.bzl", "TEST_COPTS")
cc_test(

Some files were not shown because too many files have changed in this diff Show More