Skip to content

Commit

Permalink
Merge pull request #27 from wolf-org/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
VirtueSky authored Nov 22, 2024
2 parents 835b7c5 + b5a7ee1 commit b4723ad
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 71 deletions.
31 changes: 9 additions & 22 deletions Module/Component/Buoyancy2DComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace VirtueSky.Component
{
[RequireComponent(typeof(Rigidbody2D))]
[EditorIcon("icon_csharp"), HideMonoScript]
public class Buoyancy2DComponent : BaseMono
public class Buoyancy2DComponent : CacheComponent<Rigidbody2D>
{
public Transform[] floaters;
public float underWaterDrag = 3f;
Expand All @@ -15,7 +15,6 @@ public class Buoyancy2DComponent : BaseMono
public float airAngularDrag = 0.05f;
public float floatingPower = 15f;
public float waterHeight = 0f;
public Rigidbody2D rb;
bool Underwater;

int floatersUnderWater;
Expand All @@ -31,7 +30,7 @@ public override void FixedTick()
float diff = floaters[i].position.y - waterHeight;
if (diff < 0)
{
rb.AddForceAtPosition(Vector3.up * floatingPower * Mathf.Abs(diff), floaters[i].position,
component.AddForceAtPosition(Vector3.up * floatingPower * Mathf.Abs(diff), floaters[i].position,
ForceMode2D.Force);
floatersUnderWater += 1;
if (!Underwater)
Expand All @@ -51,25 +50,13 @@ public override void FixedTick()

void SwitchState(bool isUnderwater)
{
if (isUnderwater)
{
rb.drag = underWaterDrag;
rb.angularDrag = underWaterAngularDrag;
}
else
{
rb.drag = airDrag;
rb.angularDrag = airAngularDrag;
}
}
#if UNITY_EDITOR
private void Reset()
{
if (rb == null)
{
rb = GetComponent<Rigidbody2D>();
}
}
#if UNITY_6000_0_OR_NEWER
component.linearDamping = isUnderwater ? underWaterDrag : airDrag;
component.angularDamping = isUnderwater ? underWaterAngularDrag : airAngularDrag;
#else
component.drag = isUnderwater ? underWaterDrag : airDrag;
component.angularDrag = isUnderwater ? underWaterAngularDrag : airAngularDrag;
#endif
}
}
}
31 changes: 9 additions & 22 deletions Module/Component/BuoyancyComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace VirtueSky.Component
{
[RequireComponent(typeof(Rigidbody))]
[EditorIcon("icon_csharp"), HideMonoScript]
public class BuoyancyComponent : BaseMono
public class BuoyancyComponent : CacheComponent<Rigidbody>
{
public Transform[] floaters;
public float underWaterDrag = 3f;
Expand All @@ -15,7 +15,6 @@ public class BuoyancyComponent : BaseMono
public float airAngularDrag = 0.05f;
public float floatingPower = 15f;
public float waterHeight = 0f;
public Rigidbody rb;
bool Underwater;

int floatersUnderWater;
Expand All @@ -31,7 +30,7 @@ public override void FixedTick()
float diff = floaters[i].position.y - waterHeight;
if (diff < 0)
{
rb.AddForceAtPosition(Vector3.up * floatingPower * Mathf.Abs(diff), floaters[i].position,
component.AddForceAtPosition(Vector3.up * floatingPower * Mathf.Abs(diff), floaters[i].position,
ForceMode.Force);
floatersUnderWater += 1;
if (!Underwater)
Expand All @@ -51,25 +50,13 @@ public override void FixedTick()

void SwitchState(bool isUnderwater)
{
if (isUnderwater)
{
rb.drag = underWaterDrag;
rb.angularDrag = underWaterAngularDrag;
}
else
{
rb.drag = airDrag;
rb.angularDrag = airAngularDrag;
}
}
#if UNITY_EDITOR
private void Reset()
{
if (rb == null)
{
rb = GetComponent<Rigidbody>();
}
}
#if UNITY_6000_0_OR_NEWER
component.linearDamping = isUnderwater ? underWaterDrag : airDrag;
component.angularDamping = isUnderwater ? underWaterAngularDrag : airAngularDrag;
#else
component.drag = isUnderwater ? underWaterDrag : airDrag;
component.angularDrag = isUnderwater ? underWaterAngularDrag : airAngularDrag;
#endif
}
}
}
2 changes: 0 additions & 2 deletions Module/ControlPanel/CPInAppReviewDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public static void OnDraw(Rect position)
ConstantPackage.PackageNameGGPlayCore, ConstantPackage.MaxVersionGGPlayCore);
CPUtility.DrawButtonInstallPackage("Install Google Play Common", "Remove Google Play Common",
ConstantPackage.PackageNameGGPlayCommon, ConstantPackage.MaxVersionGGPlayCommon);
CPUtility.DrawButtonInstallPackage("Install Android App Bundle", "Remove Android App Bundle",
ConstantPackage.PackageNameGGAndroidAppBundle, ConstantPackage.MaxVersionAndroidAppBundle);
CPUtility.DrawButtonInstallPackage("Install Google External Dependency Manager",
"Remove Google External Dependency Manager",
ConstantPackage.PackageNameGGExternalDependencyManager,
Expand Down
2 changes: 0 additions & 2 deletions Module/ControlPanel/CPRegisterPackageDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ static void DrawButtonAddSomePackage()
ConstantPackage.PackageNameGGPlayCore, ConstantPackage.MaxVersionGGPlayCore);
CPUtility.DrawButtonInstallPackage("Install Google Play Common", "Remove Google Play Common",
ConstantPackage.PackageNameGGPlayCommon, ConstantPackage.MaxVersionGGPlayCommon);
CPUtility.DrawButtonInstallPackage("Install Android App Bundle", "Remove Android App Bundle",
ConstantPackage.PackageNameGGAndroidAppBundle, ConstantPackage.MaxVersionAndroidAppBundle);
CPUtility.DrawButtonInstallPackage("Install Newtonsoft.Json", "Remove Newtonsoft.Json",
ConstantPackage.PackageNameNewtonsoftJson, ConstantPackage.MaxVersionNewtonsoftJson);
CPUtility.DrawButtonInstallPackage("Install PlayFab", "Remove PlayFab", ConstantPackage.PackageNamePlayFab,
Expand Down
33 changes: 13 additions & 20 deletions Module/ControlPanel/ConstantPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public class ConstantPackage
{
public const string VersionUnityCommon = "1.4.5";
public const string VersionUnityCommon = "1.4.6";
public const string PackageNameInAppPurchase = "com.unity.purchasing";
public const string MaxVersionInAppPurchase = "4.12.2";
public const string PackageNameNewtonsoftJson = "com.unity.nuget.newtonsoft-json";
Expand All @@ -20,28 +20,21 @@ public class ConstantPackage
public const string PackageNameGGPlayCore = "com.google.play.core";

public const string MaxVersionGGPlayCore =
"https://github.com/google-unity/google-play-core.git#1.8.5";
"https://github.com/pancake-llc/google-play-core.git#1.8.5";

public const string PackageNameGGPlayCommon = "com.google.play.common";

public const string MaxVersionGGPlayCommon =
"https://github.com/google-unity/google-play-common.git#1.9.2";

public const string PackageNameGGAndroidAppBundle = "com.google.android.appbundle";

public const string MaxVersionAndroidAppBundle =
"https://github.com/google-unity/android-app-bundle.git#1.9.0";
"https://github.com/pancake-llc/google-play-common.git#1.9.2";

public const string PackageNameGGExternalDependencyManager =
"com.google.external-dependency-manager";

public const string MaxVersionGGExternalDependencyManager =
"https://github.com/google-unity/external-dependency-manager.git#1.2.183";
public const string MaxVersionGGExternalDependencyManager = "https://github.com/googlesamples/unity-jar-resolver.git?path=upm#v1.2.183";

public const string PackageNameGGPlayReview = "com.google.play.review";

public const string MaxVersionGGPlayReview =
"https://github.com/google-unity/in-app-review.git#1.8.3";
public const string MaxVersionGGPlayReview = "https://github.com/pancake-llc/in-app-review.git#1.8.3";

#endregion

Expand All @@ -50,35 +43,35 @@ public class ConstantPackage
public const string PackageNameFirebaseApp = "com.google.firebase.app";

public const string MaxVersionFirebaseApp =
"https://github.com/firebase-unity/firebase-app.git#12.4.0";
"https://github.com/firebase-unity/firebase-app.git#12.4.1";

public const string PackageNameFirebaseRemoteConfig = "com.google.firebase.remote-config";

public const string MaxVersionFirebaseRemoteConfig =
"https://github.com/firebase-unity/firebase-remote-config.git#12.4.0";
"https://github.com/firebase-unity/firebase-remote-config.git#12.4.1";

public const string PackageNameFirebaseAnalytics = "com.google.firebase.analytics";

public const string MaxVersionFirebaseAnalytics =
"https://github.com/firebase-unity/firebase-analytics.git#12.4.0";
"https://github.com/firebase-unity/firebase-analytics.git#12.4.1";

public const string PackageNameFirebaseDatabase = "com.google.firebase.database";

public const string MaxVersionFirebaseDatabase =
"https://github.com/firebase-unity/firebase-database.git#12.4.0";
"https://github.com/firebase-unity/firebase-database.git#12.4.1";

public const string PackageNameFirebaseAuth = "com.google.firebase.auth";
public const string MaxVersionFirebaseAuth = "https://github.com/firebase-unity/firebase-auth.git#12.4.0";
public const string MaxVersionFirebaseAuth = "https://github.com/firebase-unity/firebase-auth.git#12.4.1";

public const string PackageNameFirebaseCrashlytics = "com.google.firebase.crashlytics";

public const string MaxVersionFirebaseCrashlytics =
"https://github.com/firebase-unity/firebase-crashlytics.git#12.4.0";
"https://github.com/firebase-unity/firebase-crashlytics.git#12.4.1";

public const string PackageNameFirebaseSupportIos = "com.google.firebase.support-ios";

public const string MaxVersionFirebaseSupportIos =
"https://github.com/firebase-unity/firebase-support-ios.git#12.4.0";
"https://github.com/firebase-unity/firebase-support-ios.git#12.4.1";

#endregion

Expand Down Expand Up @@ -108,7 +101,7 @@ public class ConstantPackage
public const string PackageNameCoffeeUIParticle = "com.coffee.ui-particle";

public const string MaxVersionCoffeeUIParticle =
"https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.10.2";
"https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.10.3";

public const string PackageNameAppleSignIn = "com.lupidan.apple-signin-unity";

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
### 1: Download the repo and drop it into folder `Assets`
### 2: Add the line below to `Packages/manifest.json`

for version `1.4.5`
for version `1.4.6`
```csharp
"com.wolf-org.sunflower2":"https://github.com/wolf-org/sunflower_2.git#1.4.5",
"com.wolf-org.sunflower2":"https://github.com/wolf-org/sunflower_2.git#1.4.6",
```

## Includes modules
Expand All @@ -46,6 +46,7 @@ for version `1.4.5`
├── Mobile Notification
├── Object Pooling
├── Prime tween
├── Localization
├── FolderIcons
├── Hierarchy
├── In app review
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.wolf-org.sunflower2",
"displayName": "Sunflower2",
"description": "Core singleton for building Unity games ",
"version": "1.4.5",
"version": "1.4.6",
"unity": "2022.3",
"category": "virtuesky",
"license": "MIT",
Expand Down

0 comments on commit b4723ad

Please sign in to comment.