Skip to content

Commit 4657fb9

Browse files
committed
Bag Fix
1 parent c792a42 commit 4657fb9

File tree

12 files changed

+101
-1976
lines changed

12 files changed

+101
-1976
lines changed

Assets/Plugins/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset

Lines changed: 10 additions & 1965 deletions
Large diffs are not rendered by default.

Assets/Scripts/Code/Camera/CameraMovement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class CameraMovement : MonoBehaviour, IDragHandler, IPointerDownHandler, IPointerUpHandler
66
{
7-
private const string idCamera = "Camera";
7+
public const string idCamera = "Camera";
88
private Camera cameraForMove;
99
[SerializeField] private float duration = 1;
1010
[SerializeField] private float startSpeed = 3;

Assets/Scripts/Code/RoomService.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class RoomService : MonoBehaviour
6+
{
7+
public RoomItems[] roomItems;
8+
public RoomItems[] roomSecondItems;
9+
void Start()
10+
{
11+
RoomForFilling.instance.SetRooms(this);
12+
}
13+
14+
// Update is called once per frame
15+
void Update()
16+
{
17+
18+
}
19+
}

Assets/Scripts/Code/RoomService.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/Code/StartGame/StartGameBar.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ private void Start()
1515
if (!_isFirstTime)
1616
return;
1717
_isFirstTime = false;
18+
if(bar == null)
19+
return;
1820
bar.DOFillAmount(1, duration).SetEase(Ease.OutSine)
19-
.OnKill(() => playButton.DOFade(1, durationBauutonFade).OnKill(() =>
21+
.OnKill(() => playButton?.DOFade(1, durationBauutonFade).OnKill(() =>
2022
{
2123
playButton.interactable = true;
2224
playButton.blocksRaycasts = true;

Assets/Scripts/Code/Tasks/RoomFilling/RoomForFilling.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,45 @@
77
public class RoomForFilling : MonoBehaviour
88
{
99
private const string RoomForFillingIndex = "RoomForFilling";
10-
[SerializeField] private RoomItems[] roomItems;
11-
[SerializeField] private RoomItems[] roomSecondItems;
10+
11+
public static RoomForFilling instance = null;
1212
[SerializeField] private CompleteTask completeTask;
1313
[SerializeField] private NovelController novelController;
1414
private bool _isPrepared;
1515
private int _fillingIndex;
16+
17+
private static RoomService roomService;
18+
private void Awake()
19+
{
20+
if (instance == null)
21+
{
22+
instance = this;
23+
}
24+
else
25+
{
26+
Destroy(gameObject);
27+
}
28+
DontDestroyOnLoad(gameObject);
29+
}
1630
private void Start()
1731
{
1832
if (PlayerPrefs.HasKey(RoomForFillingIndex))
1933
{
2034
_fillingIndex = PlayerPrefs.GetInt(RoomForFillingIndex);
2135
}
2236
}
37+
public void SetRooms(RoomService roomService)
38+
{
39+
RoomForFilling.roomService = roomService;
40+
}
2341
public void ItemsSwitch(UnityAction onSwiched)
2442
{
25-
roomItems[_fillingIndex].SwitchFade(onSwiched);
43+
roomService.roomItems[_fillingIndex].SwitchFade(onSwiched);
2644
_fillingIndex++;
2745
}
2846
public void ItemsSwitchNext(UnityAction onSwiched)
2947
{
30-
roomSecondItems[0].SwitchFade(onSwiched);
48+
roomService.roomSecondItems[0].SwitchFade(onSwiched);
3149
}
3250
private void OnDestroy()
3351
{

Assets/Scripts/Code/Tasks/TasksController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class TasksController : MonoBehaviour
3535
[SerializeField] private TaskScriptableObject[] secondScriptableObjects;
3636
[SerializeField] private NovelController novelController;
3737
[SerializeField] private CanvasController canvasController;
38-
[SerializeField] private RoomForFilling roomForFilling;
38+
private RoomForFilling roomForFilling;
3939

4040
private int _currentTask;
4141
private bool _isTwoActive;
@@ -49,6 +49,7 @@ public class TasksController : MonoBehaviour
4949
private bool isSecondTaskExecute;
5050
private void Start()
5151
{
52+
roomForFilling = RoomForFilling.instance;
5253
_taskComplite = completeTask;
5354
_barRefreshed = barTask;
5455
_taskComplite.Initialize(OnTaskComplete);

Assets/Scripts/Code/UI/BarTask.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ public class BarTask : BankDefault, IInit<BarRefreshed>
1717
private const string precent = "precent";
1818

1919
private event BarRefreshed _barRefreshed;
20+
private static bool isFirstTime = true;
2021
private void Start()
2122
{
23+
if (!isFirstTime)
24+
{
25+
return;
26+
}
27+
isFirstTime = false;
2228
if (PlayerPrefs.HasKey(precent))
2329
{
2430
Add(PlayerPrefs.GetInt(precent));
@@ -36,7 +42,7 @@ public override void Add(int addValue)
3642
}
3743
public void RefreshBar()
3844
{
39-
barImage.DOFillAmount((float)Value / 100, duration).OnComplete(() =>_barRefreshed?.Invoke());
45+
barImage?.DOFillAmount((float)Value / 100, duration).OnComplete(() =>_barRefreshed?.Invoke());
4046
barText.text = Value.ToString() + "%";
4147
PlayerPrefs.SetInt(precent, Value);
4248
}

Assets/Scripts/Code/UI/CanvasSetter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections;
22
using System.Collections.Generic;
33
using UnityEngine;
4-
4+
using DG.Tweening;
55
namespace Assets.Scripts.Code.UI
66
{
77
public class CanvasSetter
@@ -18,6 +18,7 @@ public void SetCanvasGroup(CanvasGroup newGroup)
1818
}
1919
if (newGroup == null)
2020
return;
21+
DOTween.Kill(CameraMovement.idCamera);
2122
_curentCanvas = newGroup;
2223
_curentCanvas.alpha = 1;
2324
_curentCanvas.interactable = true;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"MonoBehaviour": {
3+
"Version": 4,
4+
"EnableBurstCompilation": true,
5+
"EnableOptimisations": true,
6+
"EnableSafetyChecks": false,
7+
"EnableDebugInAllBuilds": false,
8+
"CpuMinTargetX32": 0,
9+
"CpuMaxTargetX32": 0,
10+
"CpuMinTargetX64": 0,
11+
"CpuMaxTargetX64": 0,
12+
"OptimizeFor": 0
13+
}
14+
}

0 commit comments

Comments
 (0)