add project files

This commit is contained in:
Boris Nikolaev
2026-08-14 01:58:31 +03:00
parent 9134cad79b
commit 5f1e94b653
4399 changed files with 12286903 additions and 0 deletions
@@ -0,0 +1,103 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Ambiance;
using OHM.UnityToolkit.UI;
using UnityEngine.Serialization;
public class UIAmbiancesProgression : MonoBehaviour
{
[SerializeField]
private UIIncrementableGauge progression;
[SerializeField]
[FormerlySerializedAs("thumbCurrent")]
private Image _thumbCurrent;
[SerializeField]
[FormerlySerializedAs("thumbAfter")]
private Image _thumbAfter;
[SerializeField]
[FormerlySerializedAs("levelStart")]
private TextWrapper _levelStart;
[SerializeField]
[FormerlySerializedAs("levelEnd")]
private TextWrapper _levelEnd;
[SerializeField]
[FormerlySerializedAs("levelPrefab")]
private UIAmbiancesProgressionLevel _levelPrefab;
[SerializeField]
private Transform levelCont;
[SerializeField]
[FormerlySerializedAs("unlockObject")]
private GameObject _unlockObject;
internal AppController appController;
private int _chestLevelIdx;
private UIAmbiancesProgressionLevel _chestLevel;
private void Start()
{
AmbianceController.Instance.OnAmbianceChange.AddListener(Refresh);
}
public void Setup(AppController app)
{
appController = app;
}
public void Refresh()
{
AmbianceController ambiances = AmbianceController.Instance;
List<AmbianceDef> list = ambiances.ambiancesDef.GetAmbiancesList();
int realIdx = ambiances.CurrentAmbianceRealIdx;
_thumbCurrent.sprite = list[realIdx].thumb;
_thumbAfter.sprite = list[(realIdx + 1) % list.Count].thumb;
int changeCount = ambiances.changeAmbianceSectionCount;
progression.QuickResetToLevel(0, (float)(ambiances.CurrentLevelIdx % changeCount) / (float)changeCount);
foreach (Transform child in levelCont)
{
Object.Destroy(child.gameObject);
}
_chestLevel = null;
int start = changeCount * ambiances.CurrentAmbianceIdx + 1;
_levelStart.text = start.ToString();
_levelEnd.text = (start + changeCount).ToString();
for (int i = 1; i < changeCount; i++)
{
UIAmbiancesProgressionLevel level = Object.Instantiate(_levelPrefab, levelCont);
int levelNum = i + start;
level.Setup(levelNum, (float)i / (float)changeCount);
}
_unlockObject.SetActive(value: false);
}
public void Victory()
{
AmbianceController ambiances = AmbianceController.Instance;
int changeCount = ambiances.changeAmbianceSectionCount;
int step = ambiances.CurrentLevelIdx % changeCount + 1;
progression.SetTargetValue((float)step / (float)changeCount, 0);
if (step == 5)
{
_unlockObject.SetActive(value: true);
}
if (_chestLevel != null && appController.GetPlayerLevel() - 1 == _chestLevelIdx)
{
_chestLevel.ShowChest();
}
}
}