Skip to content

Commit

Permalink
Merge pull request #29 from chark/prep-for-v3.0.0
Browse files Browse the repository at this point in the history
Prep for v3.0.0
  • Loading branch information
Edvinas01 committed Oct 5, 2023
2 parents b8fd68a + 91e01ad commit 24afa93
Show file tree
Hide file tree
Showing 169 changed files with 744 additions and 580 deletions.
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ When doing so, make sure to:
- Follow similar code style which is used in other scripts.
- Add test cases under [ScriptableEventAttributeTestSource](../Packages/com.chark.scriptable-events/Tests/Editor/ScriptableEventAttributeTestSource.cs) and [ScriptableEventTestSource](../Packages/com.chark.scriptable-events/Tests/Runtime/ScriptableEventTestSource.cs) when adding new event types.
- Add tests for additional features, for example how [SimpleScriptableEventTest](../Packages/com.chark.scriptable-events/Tests/Runtime/SimpleScriptableEventTest.cs) does it for an additional method that is not covered in [ScriptableEventTest](../Packages/com.chark.scriptable-events/Tests/Runtime/ScriptableEventTest.cs).
- Update documentation and samples if necessary.
14 changes: 11 additions & 3 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Scriptable Events

[![Unity 2020.3+](https://img.shields.io/badge/unity-2020.3%2B-blue.svg)](https://unity3d.com/get-unity/download)
[![Actions Status](https://github.com/chark/scriptable-events/workflows/CI/badge.svg)](https://github.com/chark/scriptable-events/actions)
[![openupm](https://img.shields.io/npm/v/com.chark.scriptable-events?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.chark.scriptable-events/)
Expand All @@ -11,6 +12,7 @@ Minimalistic and extensible event system implemented via `ScriptableObject`, ins
</p>

## Features

- Designer friendly
- Default event and listener implementations for common use-cases
- Code generation tools which can be used to create custom event and inspector scripts
Expand All @@ -19,6 +21,7 @@ Minimalistic and extensible event system implemented via `ScriptableObject`, ins
- Odin Inspector support

## Installation

This package can be installed via [OpenUPM](https://openupm.com/packages/com.chark.scriptable-events/):
```text
openupm add com.chark.scriptable-events
Expand All @@ -29,12 +32,17 @@ Or via the Unity Package Manager by [Installing from a Git URL](https://docs.uni
https://github.com/chark/scriptable-events.git#upm
```

Alternatively, you can also install it by adding the following line to `Packages/manifest.json`:
```text
"com.chark.scriptable-events": "https://github.com/chark/scriptable-events.git#upm"
Alternatively, manually install by adding the following entry to `Packages/manifest.json`:
```json
{
"com.chark.scriptable-events": "https://github.com/chark/scriptable-events.git#upm"
}
```

If you'd like to install a specific release, replace `upm` suffix with version number, e.g., `v3.0.0`. You can find all releases [here](https://github.com/chark/scriptable-events/releases).

## Links

- [Documentation](../Packages/com.chark.scriptable-events/Documentation~/README.md)
- [Contributing](CONTRIBUTING.md)
- [Changelog](../Packages/com.chark.scriptable-events/CHANGELOG.md)
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
unityVersion:
- 2020.3.25f1
- 2020.3.48f1

steps:

Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
# Test
- name: Run Tests
uses: game-ci/unity-test-runner@v2
uses: game-ci/unity-test-runner@v3.0.0
id: tests
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
Expand All @@ -68,5 +68,5 @@ jobs:
uses: actions/upload-artifact@v2
if: always()
with:
name: Test Restuls
name: Test Results
path: ${{ steps.tests.outputs.artifactsPath }}
49 changes: 35 additions & 14 deletions .github/workflows/upm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,44 @@ on:
workflow_dispatch:
inputs:
branch:
description: 'Branch'
description: 'Branch'
required: true
default: 'upm'

jobs:
split-upm:
name: Split UPM branch
deploy-upm:
name: Deploy to UPM branch
runs-on: ubuntu-latest

env:
PACKAGE_DIR: Packages/com.chark.scriptable-events
SAMPLE_SRC_DIR: Samples
SAMPLE_DST_DIR: Samples~

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: split upm branch
run: |
git branch -d ${{ github.event.inputs.branch }} &> /dev/null || echo the branch not found
git subtree split -P "$PKG_ROOT" -b ${{ github.event.inputs.branch }}
git checkout ${{ github.event.inputs.branch }}
git push -f -u origin ${{ github.event.inputs.branch }}
env:
PKG_ROOT: Packages/com.chark.scriptable-events
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create '${{ github.event.inputs.branch }}' branch from '${{ env.PACKAGE_DIR }}' directory
run: |
git branch -d '${{ github.event.inputs.branch }}' &> /dev/null || echo '${{ github.event.inputs.branch }} branch not found'
git subtree split -P '${{ env.PACKAGE_DIR }}' -b '${{ github.event.inputs.branch }}'
git checkout '${{ github.event.inputs.branch }}'
- name: Move '${{ env.SAMPLE_SRC_DIR }}' directory to '${{ env.SAMPLE_DST_DIR }}'
run: |
rm -f '${{ env.SAMPLE_SRC_DIR }}.meta'
git mv '${{ env.SAMPLE_SRC_DIR }}' '${{ env.SAMPLE_DST_DIR }}'
git config --global user.name 'github-bot'
git config --global user.email 'github-bot@users.noreply.github.com'
git add '${{ env.SAMPLE_SRC_DIR }}.meta'
git add '${{ env.SAMPLE_DST_DIR }}'
git commit -m "Move '${{ env.SAMPLE_SRC_DIR }}' directory to '${{ env.SAMPLE_DST_DIR }}'"
- name: Push '${{ github.event.inputs.branch }}' branch
run: |
git push -f -u origin '${{ github.event.inputs.branch }}'
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 CHARK
Copyright (c) 2023 CHARK

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 39 additions & 5 deletions Packages/com.chark.scriptable-events/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2022-08-04
## [v3.0.0](https://github.com/chark/scriptable-events/compare/v2.2.0...v3.0.0) - 2023-10-05

This release tidies up this package, so it is consistent with other packages published by CHARK. Additionally, this release includes a set of **breaking changes** which will affect you if you're upgrading from previous versions.

### Changes

- Renamed `BaseScriptableEvent` to `ScriptableEvent`.
- Renamed `BaseScriptableEventListener` to `ScriptableEventListener`.
- Renamed `BaseScriptableEventEditor` to `ScriptableEventEditor`.
- Renamed `BaseScriptableEventListenerEditor` to `ScriptableEventListenerEditor`.
- Updated all built-in `BaseScriptableEvent` and `ScriptableEvent` implementations to use `sealed` keyword to prevent inheriting built-in event and listener implementations.
- Updated namespaces to use `CHARK.` prefix.
- Updated menu items to use `CHARK/` prefix.
- Updated assemblies to use `CHARK.` (instead of `Chark.`) prefix in their names.
- Updated assemblies to use GUIDs instead of assembly names when referencing other assemblies.
- Updated samples as they broke after changing class names and namespaces.
- Updated script generation logic to accomodate namespace and naming changes.
- Updated Documentation to include, namespace, menu item and renaming changes. Additionally, some information regarding addressables was added as well.
- Updated Script Creator window to generate more restricted classes, with `sealed` and `internal` keywords instead of just `public`.

## [v2.2.0](https://github.com/chark/scriptable-events/compare/v2.1.0...v2.2.0) - 2022-08-04

Multi events.

### Changed

- `BaseScriptableEventListener<TArg>` now supports multiple events. This should be a non-breaking change. Migration from `scriptableEvent` to a list of `scriptableEvents` is done via `ISerializationCallbackReceiver` which is implemented in `BaseScriptableEventListener<TArg>`.

## [2.1.0] - 2022-02-05
## [v2.1.0](https://github.com/chark/scriptable-events/compare/v2.0.0...v2.1.0) - 2022-02-05

Quality of life improvements.

### Added

- Utility window to help in creation of Scriptable Events. It can be found via _Right Click > Create > Scriptable Event > Custom Scriptable Event_ (at the very bottom).
- `ScriptableEventConstants` class which can be used to order custom events more neatly.
- `BaseScriptableEvent` class (without `TArg`) which is inherited by all events and is used internally to draw inspector GUIs.
Expand All @@ -25,6 +51,7 @@ Quality of life improvements.
- Odin Inspector support via the use of `#if ODIN_INSPECTOR`.

### Changed

- Renamed Scriptable Event creation menu from _Scriptable **Events**_ to _Scriptable **Event**_.
- Moved Scriptable Event menus below _Folder_ and _Script_ creation menu items so the package is less intrusive.
- All existing events now use `ScriptableEventConstants` to define their menu order.
Expand All @@ -36,15 +63,18 @@ Quality of life improvements.
- Reworked all samples to be more consistent.
- Updated usage documentation to follow new samples and showcase event creation.

## [2.0.0] - 2021-07-07
## [v2.0.0](https://github.com/chark/scriptable-events/compare/v1.0.1...v2.0.0) - 2021-07-07

This release contains major breaking changes and migrates from 2019 (LTS) to 2020 (LTS) in order to utilise generics.

### Added

- `BaseScriptableEventEditor` by default applies to all `BaseScriptableEvent<T>` assets. `BaseScriptableEventEditor<T>` (with a generic type) should be used only if `Raise` button functionality is required.
- Additional listener info including listener counts (see below "Added Listeners" label on `IScriptableEvent` assets).
- Events, listeners and editors (except editors for `Collision*` types) for `long`, `double`, `Quaternion`, `Collider`, `Collider2D`, `Collision`, `Collision2D` types.

### Changed

- All public `BaseScriptableEvent<T>` methods apart from `Raise` were renamed to have a `*Listener` suffix.
- Each listener now uses a generic `BaseScriptableEvent<T>` field instead of a concrete implementation. The additional argument for the event type as well as the `UnityEvent` type is no longer required.
- All events have been moved to `ScriptableEvents.Events` namespace to avoid clashing with Unity namespaces.
Expand All @@ -53,20 +83,24 @@ This release contains major breaking changes and migrates from 2019 (LTS) to 202
- Order of components and scriptable events in menus.

### Removed

- `IScriptableEvent` interface as it had no use and only added boilerplate.
- `Listeners` property from `BaseScriptableEvent<T>`.
- All `UnityEvent` implementations.
- Duplicate listener check under `BaseScriptableEvent<T>`.

## [1.0.1] - 2021-02-07
## [v1.0.1](https://github.com/chark/scriptable-events/compare/v1.0.0...v1.0.1) - 2021-02-07

### Changed

- Fixed naming of GameObject event listener file. Now it should appear as expected in the editor.

## [1.0.0] - 2021-02-01
## [v1.0.0](https://github.com/chark/scriptable-events/compare/v1.0.0) - 2021-02-01

Initial release, here we list changes made after moving away from [Unity Scriptable Objects](https://github.com/chark/unity-scriptable-objects).

### Changed

- Naming of events, `*GameEvent` -> `*ScriptableEvent`.
- Rewrote event, listener and inspector GUI APIs.
- Rewrote test code.
Expand Down
Loading

0 comments on commit 24afa93

Please sign in to comment.