Initial commit
17
.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
*.iml
|
||||
.gradle
|
||||
.idea
|
||||
.kotlin
|
||||
.DS_Store
|
||||
build
|
||||
*/build
|
||||
captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
xcuserdata/
|
||||
Pods/
|
||||
*.jks
|
||||
*.gpg
|
||||
*yarn.lock
|
||||
29
README.MD
Normal file
@@ -0,0 +1,29 @@
|
||||
# ShadowrunCharSheet
|
||||
|
||||
### Android
|
||||
To run the application on android device/emulator:
|
||||
- open project in Android Studio and run imported android run configuration
|
||||
|
||||
To build the application bundle:
|
||||
- run `./gradlew :androidApp:assembleDebug`
|
||||
- find `.apk` file in `androidApp/build/outputs/apk/debug/androidApp-debug.apk`
|
||||
|
||||
### Desktop
|
||||
Run the desktop application: `./gradlew :desktopApp:run`
|
||||
Run the desktop **hot reload** application: `./gradlew :desktopApp:hotRun --auto`
|
||||
|
||||
### iOS
|
||||
To run the application on iPhone device/simulator:
|
||||
- Open `iosApp/iosApp.xcproject` in Xcode and run standard configuration
|
||||
- Or use [Kotlin Multiplatform Mobile plugin](https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile) for Android Studio
|
||||
|
||||
### Web Distribution
|
||||
Build web distribution: `./gradlew :webApp:composeCompatibilityBrowserDistribution`
|
||||
Deploy a dir `webApp/build/dist/composeWebCompatibility/productionExecutable` to a web server
|
||||
|
||||
### JS Browser
|
||||
Run the browser application: `./gradlew :webApp:jsBrowserDevelopmentRun`
|
||||
|
||||
### Wasm Browser
|
||||
Run the browser application: `./gradlew :webApp:wasmJsBrowserDevelopmentRun`
|
||||
|
||||
28
androidApp/build.gradle.kts
Normal file
@@ -0,0 +1,28 @@
|
||||
plugins {
|
||||
alias(libs.plugins.compose.compiler)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.android.application)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "org.shahondin1624"
|
||||
compileSdk = 36
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 23
|
||||
targetSdk = 36
|
||||
|
||||
applicationId = "org.shahondin1624.androidApp"
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":sharedUI"))
|
||||
implementation(libs.androidx.activityCompose)
|
||||
}
|
||||
21
androidApp/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="ShadowrunCharSheet"
|
||||
android:theme="@android:style/Theme.Material.NoActionBar">
|
||||
<activity
|
||||
android:name=".AppActivity"
|
||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
33
androidApp/src/main/kotlin/org/shahondin1624/AppActivity.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
package org.shahondin1624
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
|
||||
class AppActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContent {
|
||||
App(onThemeChanged = { ThemeChanged(it) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ThemeChanged(isDark: Boolean) {
|
||||
val view = LocalView.current
|
||||
LaunchedEffect(isDark) {
|
||||
val window = (view.context as Activity).window
|
||||
WindowInsetsControllerCompat(window, window.decorView).apply {
|
||||
isAppearanceLightStatusBars = isDark
|
||||
isAppearanceLightNavigationBars = isDark
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
|
||||
</adaptive-icon>
|
||||
BIN
androidApp/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
androidApp/src/main/res/mipmap-hdpi/ic_launcher_background.png
Normal file
|
After Width: | Height: | Size: 841 B |
BIN
androidApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
androidApp/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
androidApp/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
androidApp/src/main/res/mipmap-mdpi/ic_launcher_background.png
Normal file
|
After Width: | Height: | Size: 449 B |
BIN
androidApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
androidApp/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
androidApp/src/main/res/mipmap-xhdpi/ic_launcher_background.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
androidApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
androidApp/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
androidApp/src/main/res/mipmap-xxhdpi/ic_launcher_background.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
androidApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
androidApp/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
12
build.gradle.kts
Normal file
@@ -0,0 +1,12 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.multiplatform).apply(false)
|
||||
alias(libs.plugins.compose.compiler).apply(false)
|
||||
alias(libs.plugins.compose.multiplatform).apply(false)
|
||||
alias(libs.plugins.kotlin.android).apply(false)
|
||||
alias(libs.plugins.android.application).apply(false)
|
||||
alias(libs.plugins.android.kmp.library).apply(false)
|
||||
alias(libs.plugins.kotlin.jvm).apply(false)
|
||||
alias(libs.plugins.compose.hot.reload).apply(false)
|
||||
alias(libs.plugins.kotlinx.serialization).apply(false)
|
||||
alias(libs.plugins.metro).apply(false)
|
||||
}
|
||||
BIN
desktopApp/appIcons/LinuxIcon.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
desktopApp/appIcons/MacosIcon.icns
Normal file
BIN
desktopApp/appIcons/WindowsIcon.ico
Normal file
|
After Width: | Height: | Size: 30 KiB |
41
desktopApp/build.gradle.kts
Normal file
@@ -0,0 +1,41 @@
|
||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||
import org.jetbrains.compose.reload.gradle.ComposeHotRun
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.compose.compiler)
|
||||
alias(libs.plugins.compose.multiplatform)
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
alias(libs.plugins.compose.hot.reload)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":sharedUI"))
|
||||
implementation(compose.ui)
|
||||
}
|
||||
|
||||
compose.desktop {
|
||||
application {
|
||||
mainClass = "MainKt"
|
||||
|
||||
nativeDistributions {
|
||||
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
||||
packageName = "ShadowrunCharSheet"
|
||||
packageVersion = "1.0.0"
|
||||
|
||||
linux {
|
||||
iconFile.set(project.file("appIcons/LinuxIcon.png"))
|
||||
}
|
||||
windows {
|
||||
iconFile.set(project.file("appIcons/WindowsIcon.ico"))
|
||||
}
|
||||
macOS {
|
||||
iconFile.set(project.file("appIcons/MacosIcon.icns"))
|
||||
bundleID = "org.shahondin1624.desktopApp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<ComposeHotRun>().configureEach {
|
||||
mainClass = "MainKt"
|
||||
}
|
||||
18
desktopApp/src/main/kotlin/main.kt
Normal file
@@ -0,0 +1,18 @@
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Window
|
||||
import androidx.compose.ui.window.application
|
||||
import androidx.compose.ui.window.rememberWindowState
|
||||
import java.awt.Dimension
|
||||
import org.shahondin1624.App
|
||||
|
||||
fun main() = application {
|
||||
Window(
|
||||
title = "ShadowrunCharSheet",
|
||||
state = rememberWindowState(width = 800.dp, height = 600.dp),
|
||||
onCloseRequest = ::exitApplication,
|
||||
) {
|
||||
window.minimumSize = Dimension(350, 600)
|
||||
App()
|
||||
}
|
||||
}
|
||||
|
||||
18
gradle.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
#Gradle
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
org.gradle.caching=true
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
#Kotlin
|
||||
kotlin.code.style=official
|
||||
kotlin.daemon.jvmargs=-Xmx4G
|
||||
kotlin.native.binary.gc=cms
|
||||
kotlin.incremental.wasm=true
|
||||
|
||||
#Android
|
||||
android.useAndroidX=true
|
||||
android.nonTransitiveRClass=true
|
||||
#Compose
|
||||
org.jetbrains.compose.experimental.jscanvas.enabled=true
|
||||
61
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,61 @@
|
||||
[versions]
|
||||
|
||||
kotlin = "2.2.20"
|
||||
compose-multiplatform = "1.9.0"
|
||||
agp = "8.12.3"
|
||||
androidx-activityCompose = "1.10.1"
|
||||
compose-hot-reload = "1.0.0-beta09"
|
||||
kotlinx-coroutines = "1.10.2"
|
||||
ktor = "3.3.0"
|
||||
androidx-lifecycle = "2.9.4"
|
||||
androidx-navigation = "2.9.0"
|
||||
kotlinx-serialization = "1.9.0"
|
||||
metro = "0.6.8"
|
||||
coil = "3.3.0"
|
||||
multiplatformSettings = "1.3.0"
|
||||
kstore = "1.0.0"
|
||||
materialKolor = "3.0.1"
|
||||
materialIcons = "1.7.1"
|
||||
|
||||
[libraries]
|
||||
|
||||
androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
|
||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
|
||||
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
|
||||
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
|
||||
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
|
||||
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
|
||||
ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" }
|
||||
ktor-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
|
||||
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
|
||||
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
|
||||
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
||||
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
|
||||
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
|
||||
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
|
||||
androidx-lifecycle-viewmodel = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
|
||||
androidx-lifecycle-runtime = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
|
||||
androidx-navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "androidx-navigation" }
|
||||
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
|
||||
coil = { module = "io.coil-kt.coil3:coil-compose-core", version.ref = "coil" }
|
||||
coil-network-ktor = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coil" }
|
||||
multiplatformSettings = { module = "com.russhwolf:multiplatform-settings-no-arg", version.ref = "multiplatformSettings" }
|
||||
kstore = { module = "io.github.xxfast:kstore", version.ref = "kstore" }
|
||||
kstore-file = { module = "io.github.xxfast:kstore-file", version.ref = "kstore" }
|
||||
kstore-storage = { module = "io.github.xxfast:kstore-storage", version.ref = "kstore" }
|
||||
materialKolor = { module = "com.materialkolor:material-kolor", version.ref = "materialKolor" }
|
||||
materialIcons = { module = "org.jetbrains.compose.material:material-icons-extended", version.ref = "materialIcons"}
|
||||
|
||||
[plugins]
|
||||
|
||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
compose-multiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
android-kmp-library = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
compose-hot-reload = { id = "org.jetbrains.compose.hot-reload", version.ref = "compose-hot-reload" }
|
||||
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||
metro = { id = "dev.zacsweers.metro", version.ref = "metro" }
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
251
gradlew
vendored
Executable file
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t % %/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
94
gradlew.bat
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
360
iosApp/iosApp.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,360 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 56;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
A93A953B29CC810C00F8E227 /* iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93A953A29CC810C00F8E227 /* iosApp.swift */; };
|
||||
A93A953F29CC810D00F8E227 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A93A953E29CC810D00F8E227 /* Assets.xcassets */; };
|
||||
A93A954229CC810D00F8E227 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A93A954129CC810D00F8E227 /* Preview Assets.xcassets */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
A93A953729CC810C00F8E227 /* ShadowrunCharSheet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ShadowrunCharSheet.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A93A953A29CC810C00F8E227 /* iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosApp.swift; sourceTree = "<group>"; };
|
||||
A93A953E29CC810D00F8E227 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
A93A954129CC810D00F8E227 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
A93A953429CC810C00F8E227 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
A93A952E29CC810C00F8E227 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A93A953929CC810C00F8E227 /* iosApp */,
|
||||
A93A953829CC810C00F8E227 /* Products */,
|
||||
C4127409AE3703430489E7BC /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A93A953829CC810C00F8E227 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A93A953729CC810C00F8E227 /* ShadowrunCharSheet.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A93A953929CC810C00F8E227 /* iosApp */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A93A953A29CC810C00F8E227 /* iosApp.swift */,
|
||||
A93A953E29CC810D00F8E227 /* Assets.xcassets */,
|
||||
A93A954029CC810D00F8E227 /* Preview Content */,
|
||||
);
|
||||
path = iosApp;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A93A954029CC810D00F8E227 /* Preview Content */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A93A954129CC810D00F8E227 /* Preview Assets.xcassets */,
|
||||
);
|
||||
path = "Preview Content";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C4127409AE3703430489E7BC /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
A93A953629CC810C00F8E227 /* iosApp */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = A93A954529CC810D00F8E227 /* Build configuration list for PBXNativeTarget "iosApp" */;
|
||||
buildPhases = (
|
||||
A9D80A052AAB5CDE006C8738 /* ShellScript */,
|
||||
A93A953329CC810C00F8E227 /* Sources */,
|
||||
A93A953429CC810C00F8E227 /* Frameworks */,
|
||||
A93A953529CC810C00F8E227 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = iosApp;
|
||||
productName = iosApp;
|
||||
productReference = A93A953729CC810C00F8E227 /* ShadowrunCharSheet.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
A93A952F29CC810C00F8E227 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1420;
|
||||
LastUpgradeCheck = 1420;
|
||||
TargetAttributes = {
|
||||
A93A953629CC810C00F8E227 = {
|
||||
CreatedOnToolsVersion = 14.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = A93A953229CC810C00F8E227 /* Build configuration list for PBXProject "iosApp" */;
|
||||
compatibilityVersion = "Xcode 14.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = A93A952E29CC810C00F8E227;
|
||||
productRefGroup = A93A953829CC810C00F8E227 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
A93A953629CC810C00F8E227 /* iosApp */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
A93A953529CC810C00F8E227 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A93A954229CC810D00F8E227 /* Preview Assets.xcassets in Resources */,
|
||||
A93A953F29CC810D00F8E227 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
A9D80A052AAB5CDE006C8738 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "cd \"$SRCROOT/..\"\n./gradlew :sharedUI:embedAndSignAppleFrameworkForXcode\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
A93A953329CC810C00F8E227 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A93A953B29CC810C00F8E227 /* iosApp.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
A93A954329CC810D00F8E227 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A93A954429CC810D00F8E227 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
A93A954629CC810D00F8E227 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = iosApp/Info.plist;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.shahondin1624.iosApp;
|
||||
PRODUCT_NAME = "ShadowrunCharSheet";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A93A954729CC810D00F8E227 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = iosApp/Info.plist;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.shahondin1624.iosApp;
|
||||
PRODUCT_NAME = "ShadowrunCharSheet";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
A93A953229CC810C00F8E227 /* Build configuration list for PBXProject "iosApp" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A93A954329CC810D00F8E227 /* Debug */,
|
||||
A93A954429CC810D00F8E227 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
A93A954529CC810D00F8E227 /* Build configuration list for PBXNativeTarget "iosApp" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A93A954629CC810D00F8E227 /* Debug */,
|
||||
A93A954729CC810D00F8E227 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = A93A952F29CC810C00F8E227 /* Project object */;
|
||||
}
|
||||
7
iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 636 B |
BIN
iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/AppIcon-29.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
BIN
iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/AppIcon@2x.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
BIN
iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/AppIcon@3x.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
130
iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
@@ -0,0 +1,130 @@
|
||||
{
|
||||
"images": [
|
||||
{
|
||||
"filename": "AppIcon@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "60x60"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "60x60"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "76x76"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon@2x~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "76x76"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-83.5@2x~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "83.5x83.5"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-40@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "40x40"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-40@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "40x40"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-40~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "40x40"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-40@2x~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "40x40"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-20@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "20x20"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-20@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "20x20"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-20~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "20x20"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-20@2x~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "20x20"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-29.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "1x",
|
||||
"size": "29x29"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-29@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "29x29"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-29@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "29x29"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-29~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "29x29"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-29@2x~ipad.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "29x29"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-60@2x~car.png",
|
||||
"idiom": "car",
|
||||
"scale": "2x",
|
||||
"size": "60x60"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon-60@3x~car.png",
|
||||
"idiom": "car",
|
||||
"scale": "3x",
|
||||
"size": "60x60"
|
||||
},
|
||||
{
|
||||
"filename": "AppIcon~ios-marketing.png",
|
||||
"idiom": "ios-marketing",
|
||||
"scale": "1x",
|
||||
"size": "1024x1024"
|
||||
}
|
||||
]
|
||||
}
|
||||
6
iosApp/iosApp/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
8
iosApp/iosApp/Info.plist
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
21
iosApp/iosApp/iosApp.swift
Normal file
@@ -0,0 +1,21 @@
|
||||
import SwiftUI
|
||||
import SharedUI
|
||||
|
||||
@main
|
||||
struct ComposeApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView().ignoresSafeArea(.all)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView: UIViewControllerRepresentable {
|
||||
func makeUIViewController(context: Context) -> UIViewController {
|
||||
return MainKt.MainViewController()
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
|
||||
// Updates will be handled by Compose
|
||||
}
|
||||
}
|
||||
40
settings.gradle.kts
Normal file
@@ -0,0 +1,40 @@
|
||||
rootProject.name = "ShadowrunCharSheet"
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google {
|
||||
content {
|
||||
includeGroupByRegex("com\\.android.*")
|
||||
includeGroupByRegex("com\\.google.*")
|
||||
includeGroupByRegex("androidx.*")
|
||||
includeGroupByRegex("android.*")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
google {
|
||||
content {
|
||||
includeGroupByRegex("com\\.android.*")
|
||||
includeGroupByRegex("com\\.google.*")
|
||||
includeGroupByRegex("androidx.*")
|
||||
includeGroupByRegex("android.*")
|
||||
}
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
//https://github.com/JetBrains/compose-hot-reload?tab=readme-ov-file#set-up-automatic-provisioning-of-the-jetbrains-runtime-jbr-via-gradle
|
||||
id("org.gradle.toolchains.foojay-resolver-convention").version("1.0.0")
|
||||
}
|
||||
|
||||
include(":sharedUI")
|
||||
include(":androidApp")
|
||||
include(":desktopApp")
|
||||
include(":webApp")
|
||||
|
||||
96
sharedUI/build.gradle.kts
Normal file
@@ -0,0 +1,96 @@
|
||||
import org.jetbrains.compose.ExperimentalComposeLibrary
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.multiplatform)
|
||||
alias(libs.plugins.compose.compiler)
|
||||
alias(libs.plugins.compose.multiplatform)
|
||||
alias(libs.plugins.android.kmp.library)
|
||||
alias(libs.plugins.compose.hot.reload)
|
||||
alias(libs.plugins.kotlinx.serialization)
|
||||
alias(libs.plugins.metro)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
android {
|
||||
namespace = "org.shahondin1624"
|
||||
compileSdk = 36
|
||||
minSdk = 23
|
||||
androidResources.enable = true
|
||||
}
|
||||
|
||||
jvm()
|
||||
|
||||
js { browser() }
|
||||
wasmJs { browser() }
|
||||
|
||||
iosX64()
|
||||
iosArm64()
|
||||
iosSimulatorArm64()
|
||||
|
||||
sourceSets {
|
||||
commonMain.dependencies {
|
||||
implementation(compose.runtime)
|
||||
implementation(compose.ui)
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.material3)
|
||||
implementation(compose.components.resources)
|
||||
implementation(compose.components.uiToolingPreview)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.ktor.client.core)
|
||||
implementation(libs.ktor.client.content.negotiation)
|
||||
implementation(libs.ktor.client.serialization)
|
||||
implementation(libs.ktor.serialization.json)
|
||||
implementation(libs.ktor.client.logging)
|
||||
implementation(libs.androidx.lifecycle.viewmodel)
|
||||
implementation(libs.androidx.lifecycle.runtime)
|
||||
implementation(libs.androidx.navigation.compose)
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
implementation(libs.coil)
|
||||
implementation(libs.coil.network.ktor)
|
||||
implementation(libs.multiplatformSettings)
|
||||
implementation(libs.kstore)
|
||||
implementation(libs.materialKolor)
|
||||
implementation(libs.materialIcons)
|
||||
}
|
||||
|
||||
commonTest.dependencies {
|
||||
implementation(kotlin("test"))
|
||||
@OptIn(ExperimentalComposeLibrary::class)
|
||||
implementation(compose.uiTest)
|
||||
implementation(libs.kotlinx.coroutines.test)
|
||||
}
|
||||
|
||||
androidMain.dependencies {
|
||||
implementation(compose.uiTooling)
|
||||
implementation(libs.kotlinx.coroutines.android)
|
||||
implementation(libs.ktor.client.okhttp)
|
||||
implementation(libs.kstore.file)
|
||||
}
|
||||
|
||||
jvmMain.dependencies {
|
||||
implementation(compose.desktop.currentOs)
|
||||
implementation(libs.kotlinx.coroutines.swing)
|
||||
implementation(libs.ktor.client.okhttp)
|
||||
implementation(libs.kstore.file)
|
||||
}
|
||||
|
||||
webMain.dependencies {
|
||||
implementation(libs.kstore.storage)
|
||||
}
|
||||
|
||||
iosMain.dependencies {
|
||||
implementation(libs.ktor.client.darwin)
|
||||
implementation(libs.kstore.file)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
targets
|
||||
.withType<KotlinNativeTarget>()
|
||||
.matching { it.konanTarget.family.isAppleFamily }
|
||||
.configureEach {
|
||||
binaries { framework { baseName = "SharedUI" } }
|
||||
}
|
||||
}
|
||||
BIN
sharedUI/src/commonMain/composeResources/drawable/dice.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M12,8c-2.21,0 -4,1.79 -4,4c0,2.21 1.79,4 4,4c2.21,0 4,-1.79 4,-4C16,9.79 14.21,8 12,8zM12,14c-1.1,0 -2,-0.9 -2,-2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2C14,13.1 13.1,14 12,14z" />
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M22,7.47V5.35C20.05,4.77 16.56,4 12,4C9.85,4 7.89,4.86 6.46,6.24C6.59,5.39 6.86,3.84 7.47,2H5.35C4.77,3.95 4,7.44 4,12c0,2.15 0.86,4.11 2.24,5.54c-0.85,-0.14 -2.4,-0.4 -4.24,-1.01v2.12C3.95,19.23 7.44,20 12,20c2.15,0 4.11,-0.86 5.54,-2.24c-0.14,0.85 -0.4,2.4 -1.01,4.24h2.12C19.23,20.05 20,16.56 20,12c0,-2.15 -0.86,-4.11 -2.24,-5.54C18.61,6.59 20.16,6.86 22,7.47zM12,18c-3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6s6,2.69 6,6S15.31,18 12,18z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9s9,-4.03 9,-9c0,-0.46 -0.04,-0.92 -0.1,-1.36c-0.98,1.37 -2.58,2.26 -4.4,2.26c-2.98,0 -5.4,-2.42 -5.4,-5.4c0,-1.81 0.89,-3.42 2.26,-4.4C12.92,3.04 12.46,3 12,3L12,3z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M12,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5s5,-2.24 5,-5S14.76,7 12,7L12,7zM2,13l2,0c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1l-2,0c-0.55,0 -1,0.45 -1,1S1.45,13 2,13zM20,13l2,0c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1l-2,0c-0.55,0 -1,0.45 -1,1S19.45,13 20,13zM11,2v2c0,0.55 0.45,1 1,1s1,-0.45 1,-1V2c0,-0.55 -0.45,-1 -1,-1S11,1.45 11,2zM11,20v2c0,0.55 0.45,1 1,1s1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1C11.45,19 11,19.45 11,20zM5.99,4.58c-0.39,-0.39 -1.03,-0.39 -1.41,0c-0.39,0.39 -0.39,1.03 0,1.41l1.06,1.06c0.39,0.39 1.03,0.39 1.41,0s0.39,-1.03 0,-1.41L5.99,4.58zM18.36,16.95c-0.39,-0.39 -1.03,-0.39 -1.41,0c-0.39,0.39 -0.39,1.03 0,1.41l1.06,1.06c0.39,0.39 1.03,0.39 1.41,0c0.39,-0.39 0.39,-1.03 0,-1.41L18.36,16.95zM19.42,5.99c0.39,-0.39 0.39,-1.03 0,-1.41c-0.39,-0.39 -1.03,-0.39 -1.41,0l-1.06,1.06c-0.39,0.39 -0.39,1.03 0,1.41s1.03,0.39 1.41,0L19.42,5.99zM7.05,18.36c0.39,-0.39 0.39,-1.03 0,-1.41c-0.39,-0.39 -1.03,-0.39 -1.41,0l-1.06,1.06c-0.39,0.39 -0.39,1.03 0,1.41s1.03,0.39 1.41,0L7.05,18.36z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M15.55,5.55L11,1v3.07C7.06,4.56 4,7.92 4,12s3.05,7.44 7,7.93v-2.02c-2.84,-0.48 -5,-2.94 -5,-5.91s2.16,-5.43 5,-5.91L11,10l4.55,-4.45zM19.93,11c-0.17,-1.39 -0.72,-2.73 -1.62,-3.89l-1.42,1.42c0.54,0.75 0.88,1.6 1.02,2.47h2.02zM13,17.9v2.02c1.39,-0.17 2.74,-0.71 3.9,-1.61l-1.44,-1.44c-0.75,0.54 -1.59,0.89 -2.46,1.03zM16.89,15.48l1.42,1.41c0.9,-1.16 1.45,-2.5 1.62,-3.89h-2.02c-0.14,0.87 -0.48,1.72 -1.02,2.48z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
<string name="cyclone">Cyclone</string>
|
||||
<string name="open_github">Open github</string>
|
||||
<string name="run">Run</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="theme">Theme</string>
|
||||
</resources>
|
||||
119
sharedUI/src/commonMain/kotlin/org/shahondin1624/App.kt
Normal file
@@ -0,0 +1,119 @@
|
||||
package org.shahondin1624
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.DarkMode
|
||||
import androidx.compose.material.icons.filled.LightMode
|
||||
import androidx.compose.material.icons.filled.Menu
|
||||
import androidx.compose.material.icons.filled.Person
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.compose.ui.tooling.preview.Preview
|
||||
import org.shahondin1624.lib.components.charactermodel.attributespage.AttributesPage
|
||||
import org.shahondin1624.model.EXAMPLE_CHARACTER
|
||||
import org.shahondin1624.theme.AppTheme
|
||||
import org.shahondin1624.theme.LocalThemeIsDark
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Preview
|
||||
@Composable
|
||||
fun App(
|
||||
onThemeChanged: @Composable (isDark: Boolean) -> Unit = {}
|
||||
) = AppTheme(onThemeChanged) {
|
||||
val character = EXAMPLE_CHARACTER
|
||||
var isDark by LocalThemeIsDark.current
|
||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
ModalNavigationDrawer(
|
||||
drawerState = drawerState,
|
||||
drawerContent = {
|
||||
ModalDrawerSheet {
|
||||
Spacer(Modifier.height(16.dp))
|
||||
Text(
|
||||
"Menu",
|
||||
modifier = Modifier.padding(16.dp),
|
||||
style = MaterialTheme.typography.titleLarge
|
||||
)
|
||||
HorizontalDivider()
|
||||
Spacer(Modifier.height(8.dp))
|
||||
|
||||
NavigationDrawerItem(
|
||||
icon = { Icon(Icons.Default.Person, contentDescription = null) },
|
||||
label = { Text("Character Sheet") },
|
||||
selected = true,
|
||||
onClick = {
|
||||
scope.launch { drawerState.close() }
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp)
|
||||
)
|
||||
|
||||
NavigationDrawerItem(
|
||||
icon = { Icon(Icons.Default.Settings, contentDescription = null) },
|
||||
label = { Text("Settings") },
|
||||
selected = false,
|
||||
onClick = {
|
||||
scope.launch { drawerState.close() }
|
||||
// TODO: Navigate to settings
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Scaffold(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text("Shadowrun Character Sheet") },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = {
|
||||
scope.launch {
|
||||
if (drawerState.isClosed) {
|
||||
drawerState.open()
|
||||
} else {
|
||||
drawerState.close()
|
||||
}
|
||||
}
|
||||
}) {
|
||||
Icon(Icons.Default.Menu, contentDescription = "Menu")
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
IconButton(onClick = { isDark = !isDark }) {
|
||||
Icon(
|
||||
imageVector = if (isDark) {
|
||||
Icons.Default.LightMode
|
||||
} else {
|
||||
Icons.Default.DarkMode
|
||||
},
|
||||
contentDescription = "Toggle ${if (isDark) "Light" else "Dark"} mode"
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.windowInsetsPadding(WindowInsets.safeDrawing)
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
AttributesPage(character)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.shahondin1624.lib.components
|
||||
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
object UiConstants {
|
||||
val SMALL_PADDING = 6.dp
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package org.shahondin1624.lib.components.charactermodel
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.shahondin1624.lib.components.charactermodel.attributespage
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.jetbrains.compose.resources.painterResource
|
||||
import org.shahondin1624.lib.components.UiConstants.SMALL_PADDING
|
||||
import org.shahondin1624.lib.functions.DiceRoll
|
||||
import org.shahondin1624.model.attributes.Attribute
|
||||
import org.shahondin1624.theme.LocalThemeIsDark
|
||||
import shadowruncharsheet.sharedui.generated.resources.Res
|
||||
import shadowruncharsheet.sharedui.generated.resources.dice
|
||||
|
||||
@Composable
|
||||
fun Attribute(
|
||||
attribute: Attribute,
|
||||
onRoll: (DiceRoll) -> Unit = {
|
||||
println("Result for $attribute: ${it.result}")
|
||||
},
|
||||
) {
|
||||
var isInDarkMode by LocalThemeIsDark.current
|
||||
val textColor = if (isInDarkMode) Color.Black else Color.White
|
||||
Card {
|
||||
Row(
|
||||
verticalAlignment = androidx.compose.ui.Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Start
|
||||
) {
|
||||
Row(modifier = Modifier
|
||||
.padding(horizontal = SMALL_PADDING)
|
||||
.background(attribute.type.color, shape = androidx.compose.foundation.shape.RoundedCornerShape(4.dp))
|
||||
.clip(androidx.compose.foundation.shape.RoundedCornerShape(4.dp)),
|
||||
horizontalArrangement = Arrangement.SpaceBetween) {
|
||||
Text(
|
||||
text = attribute.type.name,
|
||||
modifier = Modifier
|
||||
.width(90.dp)
|
||||
.padding(start = SMALL_PADDING),
|
||||
textAlign = TextAlign.Center,
|
||||
color = textColor
|
||||
)
|
||||
Text(
|
||||
text = attribute.value.toString(),
|
||||
modifier = Modifier
|
||||
.padding(end = SMALL_PADDING),
|
||||
textAlign = TextAlign.Center,
|
||||
color = textColor
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
onClick = {
|
||||
val result = attribute.test()
|
||||
onRoll(result)
|
||||
},
|
||||
modifier = Modifier.padding(end = SMALL_PADDING)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(Res.drawable.dice),
|
||||
contentDescription = "Roll dice",
|
||||
colorFilter = ColorFilter.tint(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
),
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.shahondin1624.lib.components.charactermodel.attributespage
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.grid.GridCells
|
||||
import androidx.compose.foundation.lazy.grid.GridItemSpan
|
||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||
import androidx.compose.foundation.lazy.grid.items
|
||||
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.shahondin1624.model.charactermodel.ShadowrunCharacter
|
||||
|
||||
@Composable
|
||||
fun ColumnScope.AttributesPage(character: ShadowrunCharacter) {
|
||||
Box(modifier = Modifier.fillMaxWidth().weight(1f)) {
|
||||
val gridState = rememberLazyGridState()
|
||||
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Adaptive(minSize = 75.dp),
|
||||
state = gridState,
|
||||
modifier = Modifier.fillMaxSize().padding(16.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
items(
|
||||
items = character.attributes.getAllAttributes(),
|
||||
span = {
|
||||
GridItemSpan(2)
|
||||
}) { attribute ->
|
||||
Attribute(attribute)
|
||||
}
|
||||
|
||||
item(span = { GridItemSpan(maxLineSpan) }) {
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(vertical = 16.dp),
|
||||
thickness = 2.dp
|
||||
)
|
||||
}
|
||||
|
||||
items(
|
||||
items = character.talents.talents,
|
||||
span = {
|
||||
GridItemSpan(3)
|
||||
}
|
||||
) { talent ->
|
||||
Talent(talent, character.attributes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package org.shahondin1624.lib.components.charactermodel.attributespage
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.jetbrains.compose.resources.painterResource
|
||||
import org.shahondin1624.lib.components.UiConstants.SMALL_PADDING
|
||||
import org.shahondin1624.lib.functions.DiceRoll
|
||||
import org.shahondin1624.model.attributes.Attributes
|
||||
import org.shahondin1624.model.talents.TalentDefinition
|
||||
import org.shahondin1624.theme.LocalThemeIsDark
|
||||
import shadowruncharsheet.sharedui.generated.resources.Res
|
||||
import shadowruncharsheet.sharedui.generated.resources.dice
|
||||
|
||||
@Composable
|
||||
fun Talent(
|
||||
talent: TalentDefinition,
|
||||
attributes: Attributes,
|
||||
onRoll: (DiceRoll) -> Unit = {
|
||||
println("Result for $talent: ${it.result}")
|
||||
},
|
||||
) {
|
||||
var isInDarkMode by LocalThemeIsDark.current
|
||||
val textColor = if (isInDarkMode) Color.Black else Color.White
|
||||
Card {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Start
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = SMALL_PADDING)
|
||||
.background(
|
||||
talent.attribute.color,
|
||||
shape = RoundedCornerShape(4.dp)
|
||||
)
|
||||
.clip(androidx.compose.foundation.shape.RoundedCornerShape(4.dp)),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = talent.name,
|
||||
modifier = Modifier
|
||||
.width(150.dp)
|
||||
.padding(start = SMALL_PADDING),
|
||||
textAlign = TextAlign.Center,
|
||||
color = textColor
|
||||
)
|
||||
Text(
|
||||
text = attributes.getAttributeByType(talent.attribute).value.toString(),
|
||||
modifier = Modifier
|
||||
.padding(end = SMALL_PADDING),
|
||||
textAlign = TextAlign.Center,
|
||||
color = textColor
|
||||
)
|
||||
Text(
|
||||
text = talent.value.toString(),
|
||||
modifier = Modifier
|
||||
.padding(end = SMALL_PADDING),
|
||||
textAlign = TextAlign.Center,
|
||||
color = textColor
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
onClick = {
|
||||
val result = talent.test(modifiers = emptyList(), attributes = attributes)
|
||||
onRoll(result)
|
||||
},
|
||||
modifier = Modifier.padding(end = SMALL_PADDING)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(Res.drawable.dice),
|
||||
contentDescription = "Roll dice",
|
||||
colorFilter = ColorFilter.tint(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
),
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package org.shahondin1624.lib.components.settings
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.shahondin1624.lib.functions
|
||||
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.shahondin1624.model.charactermodel.ShadowrunCharacter
|
||||
|
||||
/**
|
||||
* Platform-agnostic serialization helpers for ShadowrunCharacter.
|
||||
*
|
||||
* File I/O (reading/writing from disk) should be implemented per-platform
|
||||
* (androidMain, jvmMain, iosMain, webMain). Here we only convert to/from JSON strings.
|
||||
*/
|
||||
object DataLoader {
|
||||
// Shared Json configuration used across the app
|
||||
internal val json: Json = Json {
|
||||
prettyPrint = true
|
||||
ignoreUnknownKeys = true
|
||||
// Default classDiscriminator = "type" works with our sealed TalentDefinition hierarchy
|
||||
encodeDefaults = true
|
||||
}
|
||||
|
||||
fun serialize(character: ShadowrunCharacter): String =
|
||||
json.encodeToString(character)
|
||||
|
||||
fun deserialize(jsonString: String): ShadowrunCharacter =
|
||||
json.decodeFromString(jsonString)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.shahondin1624.lib.functions
|
||||
|
||||
import kotlin.random.Random
|
||||
|
||||
fun rollDice(sides: Int) = Random.nextInt(sides) + 1
|
||||
|
||||
fun rollXDice(sides: Int = 6, numberOfDice: Int) = (0 until numberOfDice).map { rollDice(sides) }
|
||||
|
||||
fun List<Int>.countSuccesses(numberForSuccessOrHigher: Int = 5) = this.count { it >= numberForSuccessOrHigher }
|
||||
|
||||
data class DiceRoll(
|
||||
val numberOfDice: Int,
|
||||
val numberOfSides: Int = 6,
|
||||
val numberForSuccessOrHigher: Int = 5,
|
||||
val result: List<Int> = listOf(),
|
||||
val numberOfSuccesses: Int = -1
|
||||
) {
|
||||
fun roll(numberForSuccessOrHigher: Int = 5): DiceRoll = this.copy(
|
||||
result = rollXDice(sides = this.numberOfSides, numberOfDice = this.numberOfDice),
|
||||
numberOfSuccesses = result.countSuccesses(numberForSuccessOrHigher)
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.shahondin1624.model
|
||||
|
||||
import org.shahondin1624.model.attributes.Attribute
|
||||
import org.shahondin1624.model.attributes.AttributeType
|
||||
import org.shahondin1624.model.attributes.Attributes
|
||||
import org.shahondin1624.model.characterdata.CharacterData
|
||||
import org.shahondin1624.model.characterdata.Metatype
|
||||
import org.shahondin1624.model.charactermodel.ShadowrunCharacter
|
||||
import org.shahondin1624.model.charactermodel.createDamageMonitor
|
||||
import org.shahondin1624.model.talents.Talents
|
||||
import org.shahondin1624.model.talents.createAllProvidedTalents
|
||||
|
||||
val EXAMPLE_ATTRIBUTES = Attributes(
|
||||
body = Attribute(AttributeType.Body, 3),
|
||||
agility = Attribute(AttributeType.Agility, 4),
|
||||
reaction = Attribute(AttributeType.Reaction, 3),
|
||||
strength = Attribute(AttributeType.Strength, 2),
|
||||
willpower = Attribute(AttributeType.Willpower, 3),
|
||||
logic = Attribute(AttributeType.Logic, 4),
|
||||
intuition = Attribute(AttributeType.Intuition, 3),
|
||||
charisma = Attribute(AttributeType.Charisma, 2),
|
||||
edge = 2
|
||||
)
|
||||
|
||||
val EXAMPLE_CHARACTER: ShadowrunCharacter = ShadowrunCharacter(
|
||||
attributes = EXAMPLE_ATTRIBUTES,
|
||||
talents = Talents(createAllProvidedTalents()),
|
||||
characterData = CharacterData(
|
||||
concept = "Example",
|
||||
nuyen = 10500,
|
||||
essence = 6.0f,
|
||||
name = "Max Mustermann",
|
||||
metatype = Metatype.Human,
|
||||
age = 27,
|
||||
gender = "male",
|
||||
streetCred = 0,
|
||||
notoriety = 0,
|
||||
publicAwareness = 0,
|
||||
totalKarma = 55,
|
||||
currentKarma = 20
|
||||
),
|
||||
damageMonitor = createDamageMonitor(EXAMPLE_ATTRIBUTES),
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.shahondin1624.model
|
||||
|
||||
interface Versionable {
|
||||
val version: String
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.shahondin1624.model.attributes
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.shahondin1624.lib.functions.DiceRoll
|
||||
import org.shahondin1624.model.modifier.SRModifier
|
||||
import org.shahondin1624.model.modifier.accumulateModifiers
|
||||
|
||||
@Serializable
|
||||
data class Attribute(val type: AttributeType, val value: Int) {
|
||||
fun test(modifiers: List<SRModifier<*>> = emptyList()): DiceRoll {
|
||||
return modifiers.accumulateModifiers(DiceRoll(numberOfDice = value)).roll()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.shahondin1624.model.attributes
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
|
||||
@Serializable
|
||||
enum class AttributeType(@Transient val color: Color) {
|
||||
Body(Color(251, 84, 43)),
|
||||
Agility(Color(239, 229, 138)),
|
||||
Reaction(Color(89, 170, 56)),
|
||||
Strength(Color.Red),
|
||||
Willpower(Color.Blue),
|
||||
Logic(Color(147, 104, 31)),
|
||||
Intuition(Color.Gray),
|
||||
Charisma(Color(225, 172, 46))
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package org.shahondin1624.model.attributes
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import org.shahondin1624.model.Versionable
|
||||
import org.shahondin1624.model.modifier.AttributeModifier
|
||||
import org.shahondin1624.model.modifier.ModifierCache
|
||||
|
||||
@Serializable
|
||||
data class Attributes(
|
||||
private val body: Attribute,
|
||||
private val agility: Attribute,
|
||||
private val reaction: Attribute,
|
||||
private val strength: Attribute,
|
||||
private val willpower: Attribute,
|
||||
private val logic: Attribute,
|
||||
private val intuition: Attribute,
|
||||
private val charisma: Attribute,
|
||||
val edge: Int,
|
||||
@Transient
|
||||
private val cache: ModifierCache = ModifierCache(),
|
||||
override val version: String = "v0.1"
|
||||
): Versionable {
|
||||
private fun applyModifiers(modifiers: List<AttributeModifier>): Attributes {
|
||||
return cache.applyModifiers(modifiers, this)
|
||||
}
|
||||
|
||||
fun body(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).body.value
|
||||
}
|
||||
|
||||
fun agility(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).agility.value
|
||||
}
|
||||
|
||||
fun reaction(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).reaction.value
|
||||
}
|
||||
|
||||
fun strength(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).strength.value
|
||||
}
|
||||
|
||||
fun willpower(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).willpower.value
|
||||
}
|
||||
|
||||
fun logic(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).logic.value
|
||||
}
|
||||
|
||||
fun intuition(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).intuition.value
|
||||
}
|
||||
|
||||
fun charisma(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).charisma.value
|
||||
}
|
||||
|
||||
fun initiative(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).reaction.value + applyModifiers(modifiers).intuition.value
|
||||
}
|
||||
|
||||
fun matrixInitiative(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).logic.value
|
||||
}
|
||||
|
||||
fun astralInitiative(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
fun composure(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).body.value + applyModifiers(modifiers).willpower.value
|
||||
}
|
||||
|
||||
fun judgeIntent(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).intuition.value + applyModifiers(modifiers).charisma.value
|
||||
}
|
||||
|
||||
fun memory(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).logic.value + applyModifiers(modifiers).willpower.value
|
||||
}
|
||||
|
||||
fun carry(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).strength.value * 2
|
||||
}
|
||||
|
||||
fun run(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).agility.value + applyModifiers(modifiers).body.value
|
||||
}
|
||||
|
||||
fun physicalLimit(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).body.value + applyModifiers(modifiers).strength.value
|
||||
}
|
||||
|
||||
fun mentalLimit(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).willpower.value + applyModifiers(modifiers).logic.value
|
||||
}
|
||||
|
||||
fun socialLimit(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return applyModifiers(modifiers).charisma.value + applyModifiers(modifiers).body.value
|
||||
}
|
||||
|
||||
fun mageResistance(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
fun getAttributeByType(type: AttributeType): Attribute {
|
||||
return when (type) {
|
||||
AttributeType.Body -> body
|
||||
AttributeType.Agility -> agility
|
||||
AttributeType.Reaction -> reaction
|
||||
AttributeType.Strength -> strength
|
||||
AttributeType.Willpower -> willpower
|
||||
AttributeType.Logic -> logic
|
||||
AttributeType.Intuition -> intuition
|
||||
AttributeType.Charisma -> charisma
|
||||
}
|
||||
}
|
||||
|
||||
fun getAllAttributes(): List<Attribute> {
|
||||
return listOf(body, agility, reaction, strength, willpower, logic, intuition, charisma)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.shahondin1624.model.characterdata
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.shahondin1624.model.Versionable
|
||||
|
||||
@Serializable
|
||||
data class CharacterData(
|
||||
val concept: String,
|
||||
val nuyen: Int,
|
||||
val essence: Float,
|
||||
val name: String,
|
||||
val metatype: Metatype,
|
||||
val age: Int,
|
||||
val gender: String,
|
||||
val streetCred: Int,
|
||||
val notoriety: Int,
|
||||
val publicAwareness: Int,
|
||||
val totalKarma: Int,
|
||||
val currentKarma: Int,
|
||||
override val version: String = "v0.1"
|
||||
): Versionable
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.shahondin1624.model.characterdata
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
enum class Metatype {
|
||||
Human, Elf, Dwarf, Ork, Troll
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.shahondin1624.model.charactermodel
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import org.shahondin1624.model.Versionable
|
||||
import org.shahondin1624.model.attributes.Attribute
|
||||
import org.shahondin1624.model.attributes.AttributeType
|
||||
import org.shahondin1624.model.attributes.Attributes
|
||||
import org.shahondin1624.model.modifier.AttributeModifier
|
||||
import org.shahondin1624.model.modifier.ModifierCache
|
||||
|
||||
private val EMPTY_ATTRIBUTES = Attributes(
|
||||
body = Attribute(AttributeType.Body, 0),
|
||||
agility = Attribute(AttributeType.Agility, 0),
|
||||
reaction = Attribute(AttributeType.Reaction, 0),
|
||||
strength = Attribute(AttributeType.Strength, 0),
|
||||
willpower = Attribute(AttributeType.Willpower, 0),
|
||||
logic = Attribute(AttributeType.Logic, 0),
|
||||
intuition = Attribute(AttributeType.Intuition, 0),
|
||||
charisma = Attribute(AttributeType.Charisma, 0),
|
||||
edge = 0
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class DamageMonitor(
|
||||
@Transient
|
||||
private var attributes: Attributes = EMPTY_ATTRIBUTES,
|
||||
private val stunCurrent: Int = 0,
|
||||
private val physicalCurrent: Int = 0,
|
||||
private val overflowCurrent: Int = 0,
|
||||
@Transient
|
||||
private val cache: ModifierCache = ModifierCache(),
|
||||
override val version: String = "v0.1"
|
||||
): Versionable {
|
||||
init {
|
||||
require(stunCurrent >= 0) { "Stun damage cannot be negative" }
|
||||
require(stunCurrent <= stunMax()) { "Stun damage cannot exceed maximum stun damage of ${stunMax()}" }
|
||||
require(physicalCurrent >= 0) { "Physical damage cannot be negative" }
|
||||
require(physicalCurrent <= physicalMax()) { "Physical damage cannot exceed maximum physical damage of ${physicalMax()}" }
|
||||
require(overflowCurrent >= 0) { "Overflow damage cannot be negative" }
|
||||
require(overflowCurrent <= overflowMax()) { "Overflow damage cannot exceed maximum overflow damage of ${overflowMax()}" }
|
||||
}
|
||||
|
||||
private fun applyModifiers(modifiers: List<AttributeModifier>): Attributes {
|
||||
return cache.applyModifiers(modifiers, attributes)
|
||||
}
|
||||
|
||||
fun stunMax(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return 7 + (applyModifiers(modifiers).willpower() / 2.0).toInt()
|
||||
}
|
||||
|
||||
fun stunCurrent(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return stunCurrent
|
||||
}
|
||||
|
||||
fun physicalMax(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return 7 + (applyModifiers(modifiers).body() / 2.0).toInt()
|
||||
}
|
||||
|
||||
fun physicalCurrent(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return physicalCurrent
|
||||
}
|
||||
|
||||
fun overflowMax(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return (applyModifiers(modifiers).body() / 2.0).toInt()
|
||||
}
|
||||
|
||||
fun overflowCurrent(modifiers: List<AttributeModifier> = emptyList()): Int {
|
||||
return overflowCurrent
|
||||
}
|
||||
|
||||
fun getCurrentModifiers(modifiers: List<AttributeModifier> = emptyList()): List<AttributeModifier> { //TODO this does add the negative modifier every time the function is invoked
|
||||
val lastRow = physicalMax(modifiers) % 3
|
||||
val subtrahend = ((physicalCurrent(modifiers) - lastRow) / 3.0).toInt()
|
||||
return modifiers.toMutableList().apply {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
|
||||
fun setAttributes(attributes: Attributes) {
|
||||
this.attributes = attributes
|
||||
}
|
||||
}
|
||||
|
||||
fun createDamageMonitor(attributes: Attributes): DamageMonitor {
|
||||
val monitor = DamageMonitor(attributes)
|
||||
return monitor.copy(stunCurrent = monitor.stunMax(), physicalCurrent = monitor.physicalMax(), overflowCurrent = monitor.overflowMax())
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.shahondin1624.model.charactermodel
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.shahondin1624.model.Versionable
|
||||
import org.shahondin1624.model.attributes.Attributes
|
||||
import org.shahondin1624.model.characterdata.CharacterData
|
||||
import org.shahondin1624.model.talents.Talents
|
||||
|
||||
@Serializable
|
||||
data class ShadowrunCharacter(
|
||||
val characterData: CharacterData,
|
||||
val attributes: Attributes,
|
||||
val talents: Talents,
|
||||
val damageMonitor: DamageMonitor,
|
||||
override val version: String = "v0.1"
|
||||
): Versionable {
|
||||
init {
|
||||
damageMonitor.setAttributes(attributes)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.shahondin1624.model.modifier
|
||||
|
||||
import org.shahondin1624.model.attributes.Attributes
|
||||
|
||||
interface AttributeModifier: SRModifier<Attributes>
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.shahondin1624.model.modifier
|
||||
|
||||
import org.shahondin1624.model.attributes.Attributes
|
||||
|
||||
data class ModifierCache(
|
||||
private val cache: LinkedHashMap<List<AttributeModifier>, Attributes> = linkedMapOf()
|
||||
) {
|
||||
fun applyModifiers(modifiers: List<AttributeModifier> = emptyList(), attributes: Attributes): Attributes {
|
||||
if (cache.containsKey(modifiers)) {
|
||||
return cache[modifiers]!!
|
||||
}
|
||||
val modified = modifiers.fold(attributes) { acc, modifier -> modifier.apply(acc) }
|
||||
cache[modifiers] = modified
|
||||
while (cache.size > 5) {
|
||||
val oldestKey = cache.keys.firstOrNull()
|
||||
oldestKey?.let {
|
||||
cache.remove(oldestKey)
|
||||
}
|
||||
}
|
||||
return modified
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.shahondin1624.model.modifier
|
||||
|
||||
import org.shahondin1624.lib.functions.DiceRoll
|
||||
|
||||
interface SRModifier<T> {
|
||||
fun apply(value: T): T
|
||||
fun getDiceRollModifier(diceRoll: DiceRoll): SRModifier<DiceRoll>
|
||||
}
|
||||
|
||||
fun List<SRModifier<*>>.accumulateModifiers(diceRoll: DiceRoll): DiceRoll = this.fold(diceRoll) { acc, modifier ->
|
||||
modifier.getDiceRollModifier(acc).apply(acc)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.shahondin1624.model.modifier
|
||||
|
||||
import org.shahondin1624.model.talents.TalentDefinition
|
||||
|
||||
interface TalentModifier: SRModifier<TalentDefinition>
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.shahondin1624.model.talents
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.shahondin1624.model.attributes.AttributeType
|
||||
import org.shahondin1624.model.attributes.AttributeType.*
|
||||
|
||||
@Serializable
|
||||
enum class ProvidedTalentName(val attribute: AttributeType) {
|
||||
Aeronautics_Mechanic(Logic),
|
||||
Alchemy(Logic),
|
||||
Animal_Handling(Charisma),
|
||||
Arcana(Intuition),
|
||||
Archery(Agility),
|
||||
Armorer(Logic),
|
||||
Artificing(Logic),
|
||||
Artisan(Agility),
|
||||
Assensing(Intuition),
|
||||
Astral_Combat(Willpower),
|
||||
Automatics(Agility),
|
||||
Automotive_Mechanic(Logic),
|
||||
Banishing(Willpower),
|
||||
Binding(Willpower),
|
||||
Biotechnology(Logic),
|
||||
Blades(Strength),
|
||||
Chemistry(Logic),
|
||||
Clubs(Strength),
|
||||
//TODO Logic
|
||||
Computer(Logic),
|
||||
Sligth_of_hand(Charisma),
|
||||
Counterspelling(Willpower),
|
||||
Cybercombat(Logic),
|
||||
Cybertechnology(Logic),
|
||||
//TODO Logic
|
||||
Demolitions(Intuition),
|
||||
Disenchanting(Willpower),
|
||||
Disguise(Intuition),
|
||||
Diving(Body),
|
||||
Electronic_Warfare(Logic),
|
||||
Escape_Artist(Agility),
|
||||
Etiquette(Charisma),
|
||||
//TODO Exotics
|
||||
First_Aid(Intuition),
|
||||
Forgery(Logic),
|
||||
Free_Fall(Agility),
|
||||
Gunnery(Agility),
|
||||
Gymnastics(Agility),
|
||||
Hacking(Logic),
|
||||
Hardware(Logic),
|
||||
Heavy_Weapons(Strength),
|
||||
Impersonation(Charisma),
|
||||
Industrial_Mechanic(Logic),
|
||||
Instruction(Charisma),
|
||||
Intimidation(Charisma),
|
||||
Leadership(Charisma),
|
||||
Locksmith(Intuition),
|
||||
Longarms(Agility),
|
||||
Medicine(Logic),
|
||||
Nautical_Mechanic(Logic),
|
||||
Navigation(Intuition),
|
||||
Negotiation(Charisma),
|
||||
Palming(Agility),
|
||||
Perception(Intuition),
|
||||
Performance(Charisma),
|
||||
Pilot_Aerospace(Reaction),
|
||||
Pilot_Aircraft(Reaction),
|
||||
//TODO Pilot Exotic
|
||||
Pilot_Groundcraft(Reaction),
|
||||
Pilot_Walker(Reaction),
|
||||
Pilot_Watercraft(Reaction),
|
||||
Pistols(Agility),
|
||||
//TODO, Logic
|
||||
Ritual_Spellcasting(Willpower),
|
||||
Running(Body),
|
||||
Sneaking(Agility),
|
||||
Software(Logic),
|
||||
Spellcasting(Willpower),
|
||||
Summoning(Willpower),
|
||||
Survival(Intuition),
|
||||
Swimming(Body),
|
||||
Throwing_Weapons(Strength),
|
||||
Tracking(Intuition),
|
||||
Unarmed_Combat(Strength)
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.shahondin1624.model.talents
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.shahondin1624.lib.functions.DiceRoll
|
||||
import org.shahondin1624.model.attributes.AttributeType
|
||||
import org.shahondin1624.model.attributes.Attributes
|
||||
import org.shahondin1624.model.modifier.SRModifier
|
||||
import org.shahondin1624.model.modifier.accumulateModifiers
|
||||
|
||||
@Serializable
|
||||
@SerialName("Talent")
|
||||
data class Talent(
|
||||
override val name: String,
|
||||
override val attribute: AttributeType,
|
||||
override val value: Int,
|
||||
override val custom: Boolean,
|
||||
): TalentDefinition {
|
||||
override fun test(modifiers: List<SRModifier<*>>, attributes: Attributes): DiceRoll {
|
||||
val attributeValue = attributes.getAttributeByType(attribute).value
|
||||
val combined = value + attributeValue
|
||||
return modifiers.accumulateModifiers(DiceRoll(numberOfDice = combined)).roll()
|
||||
}
|
||||
}
|
||||
|
||||
private fun createProvidedTalent(provided: ProvidedTalentName, value: Int = 0) = Talent(
|
||||
name = provided.name.replace("_", " "),
|
||||
attribute = provided.attribute,
|
||||
value = value,
|
||||
custom = false
|
||||
)
|
||||
|
||||
fun createAllProvidedTalents() = ProvidedTalentName.entries.map {
|
||||
createProvidedTalent(it)
|
||||
}
|
||||
|
||||
fun createCustomTalent(name: String, attribute: AttributeType, value: Int = 0) = Talent(name, attribute, value, true)
|
||||