net.dreditor.gachasurface 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,21 +1,21 @@
1
- {
2
- "name": "DREditor.GachaSurface",
3
- "rootNamespace": "",
4
- "references": [
5
- "Unity.TextMeshPro",
6
- "DREditor",
7
- "DREditor.UIHandling",
8
- "DREditor.Presents",
9
- "DREditor.FreeTimeSurfacing",
10
- "DREditor.ItemRolling"
11
- ],
12
- "includePlatforms": [],
13
- "excludePlatforms": [],
14
- "allowUnsafeCode": false,
15
- "overrideReferences": false,
16
- "precompiledReferences": [],
17
- "autoReferenced": true,
18
- "defineConstraints": [],
19
- "versionDefines": [],
20
- "noEngineReferences": false
1
+ {
2
+ "name": "DREditor.GachaSurface",
3
+ "rootNamespace": "",
4
+ "references": [
5
+ "Unity.TextMeshPro",
6
+ "DREditor",
7
+ "DREditor.UIHandling",
8
+ "DREditor.Presents",
9
+ "DREditor.FreeTimeSurfacing",
10
+ "DREditor.ItemRolling"
11
+ ],
12
+ "includePlatforms": [],
13
+ "excludePlatforms": [],
14
+ "allowUnsafeCode": false,
15
+ "overrideReferences": false,
16
+ "precompiledReferences": [],
17
+ "autoReferenced": true,
18
+ "defineConstraints": [],
19
+ "versionDefines": [],
20
+ "noEngineReferences": false
21
21
  }
@@ -1,7 +1,7 @@
1
- fileFormatVersion: 2
2
- guid: 25a19fcae1358e342b45e8ca3523e9bb
3
- AssemblyDefinitionImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 25a19fcae1358e342b45e8ca3523e9bb
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Gacha.cs CHANGED
@@ -1,98 +1,98 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.FreeTimeSurfacing;
3
- using DREditor.ItemRolling;
4
- using DREditor.Processables;
5
- using DREditor.Utility;
6
- using UnityEngine;
7
-
8
- namespace DREditor.GachaSurface
9
- {
10
- /// <summary>
11
- ///
12
- /// </summary>
13
- [ClassHeader(nameof(SubmittableFTESurfaceCollection) + ", " + nameof(SubmittableFTESurfaceComponent) + ", " +
14
- nameof(FTESurfaceComponent) + ", " + nameof(ISubmittable) + ", " + nameof(IComponentsCache) + ", " +
15
- nameof(IRollerContainer) +
16
- "\n\n")]
17
- public class Gacha : SubmittableFTESurfaceCollection, IRollerContainer
18
- {
19
- /// <summary>
20
- ///
21
- /// </summary>
22
- [Header("")]
23
- [Divider]
24
- [Tooltip("")]
25
- [SerializeField] protected ItemRollerBase roller;
26
-
27
-
28
- /// <inheritdoc/>
29
- public virtual IItemRoller GetRoller() => roller;
30
-
31
-
32
- /// <inheritdoc/>
33
- protected override void OnSubmit()
34
- {
35
- RollItem();
36
-
37
- ProcessRollResult();
38
- }
39
-
40
- /// <summary>
41
- ///
42
- /// </summary>
43
- protected virtual void RollItem() => roller.RollForItem();
44
-
45
- /// <summary>
46
- ///
47
- /// </summary>
48
- protected virtual void ProcessRollResult()
49
- {
50
- if (RollSucceded())
51
- OnRollSucceded();
52
- else
53
- OnRollFailed();
54
- }
55
-
56
- /// <summary>
57
- ///
58
- /// </summary>
59
- /// <returns></returns>
60
- protected virtual bool RollSucceded() => roller.TryGetRolledObject(out object _);
61
-
62
- /// <summary>
63
- ///
64
- /// </summary>
65
- protected virtual void OnRollSucceded()
66
- {
67
- this.InvokeThisPlusComponents<IItemRollerResponse>((response) => response?.InitializeForResponse(roller));
68
-
69
- base.OnSubmit();
70
- }
71
-
72
- /// <summary>
73
- ///
74
- /// </summary>
75
- protected virtual void OnRollFailed()
76
- {
77
- AlertRollFailed();
78
-
79
- base.InvokeCompleted();
80
- }
81
-
82
- /// <summary>
83
- ///
84
- /// </summary>
85
- protected virtual void AlertRollFailed() =>
86
- UnityEngine.Debug.LogWarning($"ALERT: The item roller failed in rolling an item! Forcing process as Complete.");
87
-
88
- /// <summary>
89
- ///
90
- /// </summary>
91
- protected override void InvokeCompleted()
92
- {
93
- roller.GivePlayerRolledItem();
94
-
95
- base.InvokeCompleted();
96
- }
97
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.FreeTimeSurfacing;
3
+ using DREditor.ItemRolling;
4
+ using DREditor.Processables;
5
+ using DREditor.Utility;
6
+ using UnityEngine;
7
+
8
+ namespace DREditor.GachaSurface
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [ClassHeader(nameof(SubmittableFTESurfaceCollection) + ", " + nameof(SubmittableFTESurfaceComponent) + ", " +
14
+ nameof(FTESurfaceComponent) + ", " + nameof(ISubmittable) + ", " + nameof(IComponentsCache) + ", " +
15
+ nameof(IRollerContainer) +
16
+ "\n\n")]
17
+ public class Gacha : SubmittableFTESurfaceCollection, IRollerContainer
18
+ {
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ [Header("")]
23
+ [Divider]
24
+ [Tooltip("")]
25
+ [SerializeField] protected ItemRollerBase roller;
26
+
27
+
28
+ /// <inheritdoc/>
29
+ public virtual IItemRoller GetRoller() => roller;
30
+
31
+
32
+ /// <inheritdoc/>
33
+ protected override void OnSubmit()
34
+ {
35
+ RollItem();
36
+
37
+ ProcessRollResult();
38
+ }
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ protected virtual void RollItem() => roller.RollForItem();
44
+
45
+ /// <summary>
46
+ ///
47
+ /// </summary>
48
+ protected virtual void ProcessRollResult()
49
+ {
50
+ if (RollSucceded())
51
+ OnRollSucceded();
52
+ else
53
+ OnRollFailed();
54
+ }
55
+
56
+ /// <summary>
57
+ ///
58
+ /// </summary>
59
+ /// <returns></returns>
60
+ protected virtual bool RollSucceded() => roller.TryGetRolledObject(out object _);
61
+
62
+ /// <summary>
63
+ ///
64
+ /// </summary>
65
+ protected virtual void OnRollSucceded()
66
+ {
67
+ this.InvokeThisPlusComponents<IItemRollerResponse>((response) => response?.InitializeForResponse(roller));
68
+
69
+ base.OnSubmit();
70
+ }
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ protected virtual void OnRollFailed()
76
+ {
77
+ AlertRollFailed();
78
+
79
+ base.InvokeCompleted();
80
+ }
81
+
82
+ /// <summary>
83
+ ///
84
+ /// </summary>
85
+ protected virtual void AlertRollFailed() =>
86
+ UnityEngine.Debug.LogWarning($"ALERT: The item roller failed in rolling an item! Forcing process as Complete.");
87
+
88
+ /// <summary>
89
+ ///
90
+ /// </summary>
91
+ protected override void InvokeCompleted()
92
+ {
93
+ roller.GivePlayerRolledItem();
94
+
95
+ base.InvokeCompleted();
96
+ }
97
+ }
98
98
  }
package/Gacha.cs.meta CHANGED
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 42751e3e785fab5449addc15c1f020f8
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 42751e3e785fab5449addc15c1f020f8
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,40 +1,40 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.ItemRolling;
3
- using DREditor.Processables;
4
-
5
- namespace DREditor.GachaSurface
6
- {
7
- /// <summary>
8
- ///
9
- /// </summary>
10
- [ClassHeader(nameof(SubmittableAnimationSurfaceComponent) + ", " +
11
- nameof(ISubmittable) + ", " + nameof(IStartUpable) + ", " + nameof(IItemRollerResponse) +
12
- "\n\n")]
13
- public class ItemRolledAnimationSurface : SubmittableAnimationSurfaceComponent, IItemRollerResponse
14
- {
15
- /// <summary>
16
- ///
17
- /// </summary>
18
- protected IItemRoller itemRoller;
19
-
20
-
21
- /// <inheritdoc/>
22
- public virtual void InitializeForResponse(IItemRoller itemRoller) => this.itemRoller = itemRoller;
23
-
24
-
25
- /// <inheritdoc/>
26
- protected override void OnSubmit()
27
- {
28
- if (RolledItemValid())
29
- base.OnSubmit();
30
- else
31
- InvokeCompleted();
32
- }
33
-
34
- /// <summary>
35
- ///
36
- /// </summary>
37
- /// <returns></returns>
38
- protected virtual bool RolledItemValid() => itemRoller.TryGetRolledObject(out object _);
39
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.ItemRolling;
3
+ using DREditor.Processables;
4
+
5
+ namespace DREditor.GachaSurface
6
+ {
7
+ /// <summary>
8
+ ///
9
+ /// </summary>
10
+ [ClassHeader(nameof(SubmittableAnimationSurfaceComponent) + ", " +
11
+ nameof(ISubmittable) + ", " + nameof(IStartUpable) + ", " + nameof(IItemRollerResponse) +
12
+ "\n\n")]
13
+ public class ItemRolledAnimationSurface : SubmittableAnimationSurfaceComponent, IItemRollerResponse
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ protected IItemRoller itemRoller;
19
+
20
+
21
+ /// <inheritdoc/>
22
+ public virtual void InitializeForResponse(IItemRoller itemRoller) => this.itemRoller = itemRoller;
23
+
24
+
25
+ /// <inheritdoc/>
26
+ protected override void OnSubmit()
27
+ {
28
+ if (RolledItemValid())
29
+ base.OnSubmit();
30
+ else
31
+ InvokeCompleted();
32
+ }
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ /// <returns></returns>
38
+ protected virtual bool RolledItemValid() => itemRoller.TryGetRolledObject(out object _);
39
+ }
40
40
  }
@@ -1,2 +1,2 @@
1
- fileFormatVersion: 2
1
+ fileFormatVersion: 2
2
2
  guid: 5a45640fb18eff24d81d1eda27f9db00
@@ -1,103 +1,103 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.FreeTimeSurfacing;
3
- using DREditor.ItemRolling;
4
- using DREditor.Items;
5
- using DREditor.Processables;
6
- using System;
7
- using TMPro;
8
- using UnityEngine;
9
- using UnityEngine.Serialization;
10
- using UnityEngine.UI;
11
-
12
- namespace DREditor.GachaSurface
13
- {
14
- /// <summary>
15
- ///
16
- /// </summary>
17
- [ClassHeader(nameof(FTESurfaceComponent) + ", " + nameof(IItemRollerResponse) + ", " +
18
- nameof(IStartUpable) + ", " + nameof(ISubmittable) +
19
- "\n\n")]
20
- public class ItemRolledResponse : FTESurfaceComponent, IItemRollerResponse, IStartUpable, ISubmittable
21
- {
22
- /// <summary>
23
- ///
24
- /// </summary>
25
- [Tooltip("")]
26
- [FormerlySerializedAs("presentImage")]
27
- [SerializeField] protected Image itemImage = null;
28
-
29
- /// <summary>
30
- ///
31
- /// </summary>
32
- [Tooltip("")]
33
- [SerializeField] protected Sprite transparentSprite = null;
34
-
35
- /// <summary>
36
- ///
37
- /// </summary>
38
- [Tooltip("")]
39
- [FormerlySerializedAs("presentNameText")]
40
- [SerializeField] protected TextMeshProUGUI itemNameText = null;
41
-
42
- /// <summary>
43
- ///
44
- /// </summary>
45
- [Tooltip("")]
46
- [SerializeField] protected string presentNameSuffix = "!";
47
-
48
-
49
- /// <summary>
50
- ///
51
- /// </summary>
52
- protected IItemRoller itemRoller;
53
-
54
- /// <summary>
55
- ///
56
- /// </summary>
57
- protected IInventoryItem rolledItem;
58
-
59
-
60
- /// <inheritdoc/>
61
- public virtual void StartUp()
62
- {
63
- if (itemImage != null && transparentSprite != null)
64
- itemImage.sprite = transparentSprite;
65
- }
66
-
67
- /// <inheritdoc/>
68
- public virtual void InitializeForResponse(IItemRoller itemRoller) => this.itemRoller = itemRoller;
69
-
70
- /// <inheritdoc/>
71
- public virtual void Submit(Action onComplete)
72
- {
73
- CheckItemResponse();
74
-
75
- onComplete?.Invoke();
76
- }
77
-
78
- /// <summary>
79
- ///
80
- /// </summary>
81
- protected virtual void CheckItemResponse()
82
- {
83
- if (SuccessfullyRolledItem())
84
- DisplayItemData();
85
- }
86
-
87
- /// <summary>
88
- ///
89
- /// </summary>
90
- /// <returns></returns>
91
- protected virtual bool SuccessfullyRolledItem() => itemRoller.TryGetRolledObject(out rolledItem);
92
-
93
- /// <summary>
94
- ///
95
- /// </summary>
96
- protected virtual void DisplayItemData()
97
- {
98
- itemImage.sprite = rolledItem.Image;
99
-
100
- itemNameText.text = rolledItem.DisplayName + presentNameSuffix;
101
- }
102
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.FreeTimeSurfacing;
3
+ using DREditor.ItemRolling;
4
+ using DREditor.Items;
5
+ using DREditor.Processables;
6
+ using System;
7
+ using TMPro;
8
+ using UnityEngine;
9
+ using UnityEngine.Serialization;
10
+ using UnityEngine.UI;
11
+
12
+ namespace DREditor.GachaSurface
13
+ {
14
+ /// <summary>
15
+ ///
16
+ /// </summary>
17
+ [ClassHeader(nameof(FTESurfaceComponent) + ", " + nameof(IItemRollerResponse) + ", " +
18
+ nameof(IStartUpable) + ", " + nameof(ISubmittable) +
19
+ "\n\n")]
20
+ public class ItemRolledResponse : FTESurfaceComponent, IItemRollerResponse, IStartUpable, ISubmittable
21
+ {
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ [Tooltip("")]
26
+ [FormerlySerializedAs("presentImage")]
27
+ [SerializeField] protected Image itemImage = null;
28
+
29
+ /// <summary>
30
+ ///
31
+ /// </summary>
32
+ [Tooltip("")]
33
+ [SerializeField] protected Sprite transparentSprite = null;
34
+
35
+ /// <summary>
36
+ ///
37
+ /// </summary>
38
+ [Tooltip("")]
39
+ [FormerlySerializedAs("presentNameText")]
40
+ [SerializeField] protected TextMeshProUGUI itemNameText = null;
41
+
42
+ /// <summary>
43
+ ///
44
+ /// </summary>
45
+ [Tooltip("")]
46
+ [SerializeField] protected string presentNameSuffix = "!";
47
+
48
+
49
+ /// <summary>
50
+ ///
51
+ /// </summary>
52
+ protected IItemRoller itemRoller;
53
+
54
+ /// <summary>
55
+ ///
56
+ /// </summary>
57
+ protected IInventoryItem rolledItem;
58
+
59
+
60
+ /// <inheritdoc/>
61
+ public virtual void StartUp()
62
+ {
63
+ if (itemImage != null && transparentSprite != null)
64
+ itemImage.sprite = transparentSprite;
65
+ }
66
+
67
+ /// <inheritdoc/>
68
+ public virtual void InitializeForResponse(IItemRoller itemRoller) => this.itemRoller = itemRoller;
69
+
70
+ /// <inheritdoc/>
71
+ public virtual void Submit(Action onComplete)
72
+ {
73
+ CheckItemResponse();
74
+
75
+ onComplete?.Invoke();
76
+ }
77
+
78
+ /// <summary>
79
+ ///
80
+ /// </summary>
81
+ protected virtual void CheckItemResponse()
82
+ {
83
+ if (SuccessfullyRolledItem())
84
+ DisplayItemData();
85
+ }
86
+
87
+ /// <summary>
88
+ ///
89
+ /// </summary>
90
+ /// <returns></returns>
91
+ protected virtual bool SuccessfullyRolledItem() => itemRoller.TryGetRolledObject(out rolledItem);
92
+
93
+ /// <summary>
94
+ ///
95
+ /// </summary>
96
+ protected virtual void DisplayItemData()
97
+ {
98
+ itemImage.sprite = rolledItem.Image;
99
+
100
+ itemNameText.text = rolledItem.DisplayName + presentNameSuffix;
101
+ }
102
+ }
103
103
  }
@@ -1,2 +1,2 @@
1
- fileFormatVersion: 2
1
+ fileFormatVersion: 2
2
2
  guid: 1785380ea0d546e40b8744ae162cc578