提交小游戏项目
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
|
||||
using SGModule.DataStorage;
|
||||
using SGModule.NetKit;
|
||||
using TowerClimberChronicles;
|
||||
using UnityEngine;
|
||||
|
||||
public static partial class DataMgr {
|
||||
public static void InitPreferences(string jsonStr) {
|
||||
DataManager.Instance.AddSaveCallback(CloudDataSaver.UpdateData);
|
||||
var loginModel = LoginKit.Instance.LoginModel;
|
||||
|
||||
Debug.Log($"barry init Preferences-----0--{loginModel.Uid}--{UserID}");
|
||||
Debug.Log("GetSaveObject=====================1");
|
||||
if (loginModel.NewPlayer || loginModel.Uid != UserID.Value) {
|
||||
// Debug.Log($"barry init Preferences----1---");
|
||||
|
||||
DataManager.Instance.ClearAllData();
|
||||
UserID.Value = loginModel.Uid;
|
||||
}
|
||||
|
||||
// ObjectExtensionsTest.AsTestRun();
|
||||
|
||||
// Debug.Log($"barry init Preferences----2---{jsomnStr}");
|
||||
DataManager.Instance.ImportFromJson(jsonStr, loginModel.PlayDataVer);
|
||||
|
||||
// UserCoreMgr.Instance.LoadItemData();
|
||||
// ItemManager.GetInstance.LoadItemData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7909756ac215483c9cb403e3b225753c
|
||||
timeCreated: 1750658789
|
||||
@@ -0,0 +1,198 @@
|
||||
namespace TowerClimberChronicles
|
||||
{
|
||||
using System;
|
||||
using FairyGUI;
|
||||
using Spine.Unity;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
public class FXManager : BaseUnityManager<FXManager>
|
||||
{
|
||||
private string fxPath = "Effect/sys/";
|
||||
|
||||
FXPool<Fx_Type> fx_ObjMonoObjPool;
|
||||
|
||||
private Transform goWrapperPar;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
GameObject obj = new GameObject("FX_Pool");
|
||||
obj.transform.parent = transform;
|
||||
obj.transform.localPosition = Vector3.zero;
|
||||
obj.transform.localEulerAngles = Vector3.zero;
|
||||
fx_ObjMonoObjPool = new FXPool<Fx_Type>(obj.transform);
|
||||
fx_ObjMonoObjPool.NewObjFunc = NewObjFunc;
|
||||
fx_ObjMonoObjPool.GetObjFunc = GetObjFunc;
|
||||
fx_ObjMonoObjPool.RecObjFunc = RecObjFunc;
|
||||
}
|
||||
|
||||
private void RecObjFunc(Fx_Type arg1, Object arg2)
|
||||
{
|
||||
var componet = arg2 as Component;
|
||||
if (componet)
|
||||
componet.gameObject.SetActive(false);
|
||||
else
|
||||
{
|
||||
(arg2 as GameObject).SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetObjFunc(Fx_Type arg1, Object arg2)
|
||||
{
|
||||
var componet = arg2 as Component;
|
||||
if (componet)
|
||||
componet.gameObject.SetActive(true);
|
||||
else
|
||||
{
|
||||
(arg2 as GameObject).SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Object NewObjFunc(Fx_Type arg)
|
||||
{
|
||||
if ((int)arg < 100)
|
||||
{
|
||||
var go = LoadKit.Instance.LoadGameObjectAndCloneSync("Effect.spine." + arg, arg.ToString());
|
||||
SkeletonAnimation sk = go.GetComponent<SkeletonAnimation>();
|
||||
|
||||
return sk;
|
||||
}
|
||||
else
|
||||
{
|
||||
fxPath = "Effect.sys." + arg;
|
||||
var go = LoadKit.Instance.LoadGameObjectAndCloneSync(fxPath, arg.ToString());
|
||||
|
||||
|
||||
ParticleSystem particleSystem = go.GetComponent<ParticleSystem>();
|
||||
if (particleSystem == null)
|
||||
{
|
||||
particleSystem = go.GetComponentInChildren<ParticleSystem>();
|
||||
}
|
||||
|
||||
if (particleSystem != null)
|
||||
{
|
||||
foreach (var item in particleSystem.GetComponentsInChildren<ParticleSystem>())
|
||||
{
|
||||
var main = item.main;
|
||||
main.scalingMode = ParticleSystemScalingMode.Hierarchy;
|
||||
}
|
||||
|
||||
particleSystem.transform.localScale = Vector3.one * 100;
|
||||
return particleSystem;
|
||||
}
|
||||
|
||||
return go;
|
||||
}
|
||||
}
|
||||
|
||||
public T GetFx<T>(Fx_Type fx_Type) where T : Object
|
||||
{
|
||||
T obj = fx_ObjMonoObjPool.GetObject<T>(fx_Type);
|
||||
SkeletonAnimation ani = obj as SkeletonAnimation;
|
||||
if (ani != null)
|
||||
{
|
||||
ani.gameObject.layer = 0;
|
||||
ani.ClearState();
|
||||
ani.transform.localPosition = Vector3.zero;
|
||||
ani.transform.localEulerAngles = Vector3.zero;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public void RecFx<T>(Fx_Type fx_Type, T obj) where T : Object
|
||||
{
|
||||
fx_ObjMonoObjPool.RecObject(fx_Type, obj);
|
||||
}
|
||||
|
||||
public List<GameObject> gameObjects = new List<GameObject>();
|
||||
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
fx_ObjMonoObjPool.Dispose();
|
||||
}
|
||||
|
||||
private Queue<GoWrapper> goWrapperQueue = new Queue<GoWrapper>();
|
||||
|
||||
public T SetFx<T>(GGraph gp, Fx_Type fx_Type, ref Action Rec) where T : Component
|
||||
{
|
||||
var fx = GetFx<T>(fx_Type);
|
||||
if (fx != null)
|
||||
{
|
||||
var goWrapper = new GoWrapper(fx.gameObject);
|
||||
gp.SetNativeObject(goWrapper);
|
||||
fx.transform.localPosition = Vector3.zero;
|
||||
fx.transform.localScale = Vector3.one * 100;
|
||||
fx.transform.localEulerAngles = Vector3.zero;
|
||||
Rec += () =>
|
||||
{
|
||||
goWrapper.wrapTarget = null;
|
||||
gp.SetNativeObject(null);
|
||||
RecFx(fx_Type, fx);
|
||||
};
|
||||
}
|
||||
|
||||
return fx;
|
||||
}
|
||||
|
||||
public GameObject SetFx(GGraph gp, Fx_Type fx_Type, ref Action Rec, bool supportStencil = false)
|
||||
{
|
||||
GameObject fx = GetFx<GameObject>(fx_Type);
|
||||
if (fx != null)
|
||||
{
|
||||
var goWrapper = new GoWrapper(fx.gameObject);
|
||||
gp.SetNativeObject(goWrapper);
|
||||
fx.transform.localPosition = Vector3.zero;
|
||||
fx.transform.localScale = Vector3.one * 100;
|
||||
fx.transform.localEulerAngles = Vector3.zero;
|
||||
Rec += () =>
|
||||
{
|
||||
goWrapper.wrapTarget = null;
|
||||
gp.SetNativeObject(null);
|
||||
RecFx(fx_Type, fx);
|
||||
};
|
||||
}
|
||||
|
||||
return fx;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Fx_Type
|
||||
{
|
||||
None = -1,
|
||||
fx_monster,
|
||||
gamwin,
|
||||
fx_login_bg,
|
||||
fx_hand_pre,
|
||||
fx_wheel,
|
||||
fx_disaappear_1,
|
||||
fx_disaappear_2,
|
||||
fx_first_reward,
|
||||
fx_wins,
|
||||
fx_win,
|
||||
fx_btn_secret,
|
||||
fx_btn_login,
|
||||
fx_btn_vip,
|
||||
fx_btn_album,
|
||||
fx_btn_live,
|
||||
fx_powerup,
|
||||
fx_no_ad,
|
||||
fx_signin,
|
||||
fx_three_gift,
|
||||
fx_pass_free,
|
||||
fx_pass_premium,
|
||||
fx_proplight,
|
||||
fx_btnchat,
|
||||
fx_broad,
|
||||
fx_chatunlock,
|
||||
fx_opengame,
|
||||
fx_hall,
|
||||
fx_free_idle = 104,
|
||||
fx_ui_jinbi_click = 107,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cde96b619c044d99e1f59d178df68cd
|
||||
timeCreated: 1681806251
|
||||
@@ -0,0 +1,235 @@
|
||||
using SGModule.Common;
|
||||
using SGModule.Net;
|
||||
using SGModule.NetKit;
|
||||
|
||||
namespace TowerClimberChronicles
|
||||
{
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using IgnoreOPS;
|
||||
using System.Linq;
|
||||
|
||||
public class HallManager : BaseUnityManager<HallManager>
|
||||
{
|
||||
public event Action UpdateSecondEvent;
|
||||
public event Action UpdateFiveSecondEvent;
|
||||
|
||||
private float _secondTime;
|
||||
private float _secondTime1;
|
||||
private LoginModel loginModel;
|
||||
private bool isGameStart;
|
||||
private GameDataSystem gameDataSys;
|
||||
private WindowSystem windowSys;
|
||||
private RewardSystem rewardSys;
|
||||
private ConsumeSystem consumeSys;
|
||||
|
||||
private bool isFirstEnter = true;
|
||||
public int enterHallTimes = 0;
|
||||
public event Action UpdateEvent;
|
||||
|
||||
// public int countTimes = 0;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
game_parent = GameObject.Find("game_parent");
|
||||
Canvas = GameObject.Find("Canvas");
|
||||
flower_parent = Canvas = GameObject.Find("flower_parent");
|
||||
CtrlDispatcher.Instance.AddListener(CtrlMsg.Game_Start, OnGameStart);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.OpenGame, EnterGame);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.OpenPuzzleGame, EnterPuzzle);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.OpenFlowerGame, EnterFlower);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.BackMainScene, a =>
|
||||
{
|
||||
EnterHall();
|
||||
});
|
||||
|
||||
AppDispatcher.Instance.AddListener(MainThreadMsg.App_Focus_True, BackToGame);
|
||||
InitSystem();
|
||||
}
|
||||
|
||||
private void InitSystem()
|
||||
{
|
||||
gameDataSys = new GameDataSystem();
|
||||
windowSys = new WindowSystem();
|
||||
rewardSys = new RewardSystem();
|
||||
consumeSys = new ConsumeSystem();
|
||||
}
|
||||
|
||||
void BackToGame(object obj = null)
|
||||
{
|
||||
if (MaxPayManager.isPay)
|
||||
{
|
||||
MaxPayManager.isPay = false;
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
|
||||
MaxPayManager.Instance.PaySuccess();
|
||||
}
|
||||
|
||||
}
|
||||
private void OnGameStart(object obj)
|
||||
{
|
||||
// var lang = PlayerPrefsKit.ReadString("LangIdKey");
|
||||
// if (lang.IsNullOrWhiteSpace())
|
||||
// {
|
||||
// lang = "en";
|
||||
// }
|
||||
|
||||
// UIManager.Instance.SetSwitchLanguage(lang);
|
||||
|
||||
//初始化商品(谷歌支付和ios支付)
|
||||
PurchasingManager.InitProduct();
|
||||
|
||||
isGameStart = true;
|
||||
|
||||
bool enterGame = CommonHelper.GetBoolByChance(ConfigSystem.GetCommonConf().roomrate / 100f);
|
||||
EnterHall(true);
|
||||
// if (GameHelper.IsGiftSwitch() && enterGame)
|
||||
// {
|
||||
// // int a = ConfigSystem.GetCommonConf().BonusInside;
|
||||
// // int b = ConfigSystem.GetCommonConf().roomrate;
|
||||
// // var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
|
||||
// // DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
// // newDate = newDate.AddSeconds(GameHelper.GetNowTime(true));
|
||||
// // // Debug.Log($"barry newdate==== {newDate}");
|
||||
// // var newDays = newDate.Day;
|
||||
// // PlayerPrefs.SetInt("Dayreftimes", newDays);
|
||||
// // if (!SaveData.GetSaveObject().have_slot && ((last_time != newDays) || (UnityEngine.Random.Range(0, 100) < ConfigSystem.GetCommonConf().BonusInside)))
|
||||
// // {
|
||||
// // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.AddviewnewUI_Open);
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// EnterGame(enterGame);
|
||||
// // }
|
||||
// }
|
||||
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.EnterHall);
|
||||
|
||||
// if (DataMgr.VipLevel.Value < 0 && DataMgr.VipExpirationTime.Value > 0)
|
||||
// {
|
||||
// PurchasingManager.CheckSubExpiration(true);
|
||||
// }
|
||||
|
||||
// if (GameHelper.IsGiftSwitch()) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BroadcastUI_Open);
|
||||
}
|
||||
|
||||
private void EnterHall(object obj = null)
|
||||
{
|
||||
enterHallTimes++;
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PlayUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardAniUI_Close);
|
||||
AudioManager.Instance.PlayBGM(AudioConst.MainBg);
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Open);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TabUI_Open);
|
||||
|
||||
|
||||
GameHelper.PlayGameTimeEvent(1);
|
||||
}
|
||||
private GameObject game_parent;
|
||||
private GameObject Canvas;
|
||||
private GameObject flower_parent;
|
||||
|
||||
private void EnterGame(object obj)
|
||||
{
|
||||
// if (GameHelper.GetLevel() < GameHelper.GetCommonModel().MultiModal)
|
||||
// {
|
||||
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close);
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RainPlayUI_Open);
|
||||
// AudioManager.Instance.PlayBGM(AudioConst.GameBg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
|
||||
GameHelper.LoadSceneAsync("MainScene", () =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RainPlayUI_Open);
|
||||
});
|
||||
|
||||
AudioManager.Instance.PlayBGM(AudioConst.GameBg);
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
private void EnterPuzzle(object obj)
|
||||
{
|
||||
// if (game_parent != null) game_parent.SetActive(false);
|
||||
// if (Canvas != null) Canvas.SetActive(true);
|
||||
// if (flower_parent != null) flower_parent.SetActive(false);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TabUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.HallgameUI_Close);
|
||||
GameHelper.LoadSceneAsync("puzzle", () =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PuzzleUI_Open);
|
||||
});
|
||||
AudioManager.Instance.PlayBGM(AudioConst.GameBg);
|
||||
|
||||
}
|
||||
private void EnterFlower(object obj)
|
||||
{
|
||||
// if (game_parent != null) game_parent.SetActive(false);
|
||||
// if (Canvas != null) Canvas.SetActive(false);
|
||||
// if (flower_parent != null) flower_parent.SetActive(true);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TabUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.HallgameUI_Close);
|
||||
GameHelper.LoadSceneAsync("flower", () =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.FlowerUI_Open);
|
||||
});
|
||||
AudioManager.Instance.PlayBGM(AudioConst.GameBg);
|
||||
}
|
||||
#region 缓存资源
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!isGameStart) return;
|
||||
UpdateEvent?.Invoke();
|
||||
_secondTime += Time.deltaTime;
|
||||
_secondTime1 += Time.deltaTime;
|
||||
if (_secondTime >= 1)
|
||||
{
|
||||
_secondTime = 0;
|
||||
UpdateSecondEvent?.Invoke();
|
||||
}
|
||||
|
||||
if (_secondTime1 >= 5)
|
||||
{
|
||||
_secondTime1 = 0;
|
||||
UpdateFiveSecondEvent?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddChangeGiftSwitch(Action action)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveChangeGiftSwitch(Action action)
|
||||
{
|
||||
}
|
||||
|
||||
// void OnApplicationQuit()
|
||||
// {
|
||||
// PreferencesMgr.Instance.ImmediateSendSave();
|
||||
// }
|
||||
|
||||
private bool isInH5;
|
||||
|
||||
public void SetInH5(bool isInH5)
|
||||
{
|
||||
this.isInH5 = isInH5;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b0f6f2d2a8a4351902376d77d27b4e8
|
||||
timeCreated: 1681804729
|
||||
@@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace TowerClimberChronicles
|
||||
{
|
||||
public class NetworkManager : BaseUnityManager<NetworkManager>
|
||||
{
|
||||
#if GAME_RELEASE
|
||||
public static string crazyUrl => true ? DomainReleaseUrl : DomainDebugUrl;
|
||||
#else
|
||||
public static string crazyUrl => false ? DomainReleaseUrl : DomainDebugUrl;
|
||||
#endif
|
||||
public const string DomainRelease = "zoomatch.fun";
|
||||
//is debug test--------
|
||||
public const string DomainDebugUrl = @"https://swhitegames.top/api/";
|
||||
public static readonly string DomainReleaseUrl = $"https://{DomainRelease}/api/";
|
||||
|
||||
|
||||
|
||||
public const string identifier = "com.finedinogame.wingwizard";
|
||||
private LoginSystem loginSystem;
|
||||
private ConfigSystem configSystem;
|
||||
private PlayDataSystem playDataSystem;
|
||||
public static bool haveSimCard = false;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
InitSystem();
|
||||
}
|
||||
|
||||
private void InitSystem()
|
||||
{
|
||||
loginSystem = new LoginSystem();
|
||||
configSystem = new ConfigSystem();
|
||||
playDataSystem = new PlayDataSystem();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54f9fcd655e04ba99afa430eec09c068
|
||||
timeCreated: 1681976638
|
||||
Reference in New Issue
Block a user