ball 项目提交
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
|
||||
using SGModule.DataStorage;
|
||||
using SGModule.NetKit;
|
||||
using BallKingdomCrush;
|
||||
|
||||
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}");
|
||||
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,203 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
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,
|
||||
gamwin,
|
||||
fx_hand_pre,
|
||||
fx_wheel,
|
||||
fx_disaappear_1,
|
||||
fx_disaappear_2,
|
||||
fx_first_reward,
|
||||
fx_wins,
|
||||
fx_win,
|
||||
fx_win_title,
|
||||
fx_gamwin,
|
||||
fx_btn_shop,
|
||||
fx_btn_secret,
|
||||
fx_btn_vip,
|
||||
fx_btn_album,
|
||||
fx_btn_live,
|
||||
fx_btn_start,
|
||||
fx_pack_gold,
|
||||
fx_powerup,
|
||||
fx_no_ad,
|
||||
fx_signin,
|
||||
fx_three_gift,
|
||||
fx_pass_free,
|
||||
fx_pass_premium,
|
||||
fx_proplight,
|
||||
fx_btnchat,
|
||||
fx_chatphone,
|
||||
fx_chatvideo,
|
||||
fx_assitant,
|
||||
fx_women,
|
||||
fx_login,
|
||||
fx_login_light,
|
||||
fx_login_leaves,
|
||||
fx_free_idle = 104,
|
||||
fx_ui_jinbi_click = 107,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cde96b619c044d99e1f59d178df68cd
|
||||
timeCreated: 1681806251
|
||||
@@ -0,0 +1,203 @@
|
||||
using SGModule.Common;
|
||||
using SGModule.Net;
|
||||
using SGModule.NetKit;
|
||||
using UNSDK;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
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()
|
||||
{
|
||||
CtrlDispatcher.Instance.AddListener(CtrlMsg.Game_Start, OnGameStart);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.OpenGame, EnterGame);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.BackMainScene, (a) =>
|
||||
{
|
||||
EnterHall();
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Open);
|
||||
});
|
||||
|
||||
AppDispatcher.Instance.AddListener(MainThreadMsg.App_Focus_True, BackToGame);
|
||||
CtrlDispatcher.Instance.AddListener(CtrlMsg.open_wb, openWB);
|
||||
|
||||
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)
|
||||
{
|
||||
EnterGame(enterGame);
|
||||
}
|
||||
|
||||
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.EnterHall);
|
||||
|
||||
if (DataMgr.VipLevel.Value < 0 && DataMgr.VipExpirationTime.Value > 0)
|
||||
{
|
||||
PurchasingManager.CheckSubExpiration(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void EnterHall(object obj = null)
|
||||
{
|
||||
// int index = obj != null ? (int)obj : 2;
|
||||
|
||||
enterHallTimes++;
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PlayUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardAniUI_Close);
|
||||
AudioManager.Instance.PlayBGM(AudioConst.MainBg);
|
||||
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Open, index);
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Open);
|
||||
GameHelper.PlayGameTimeEvent(1);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
if (!DataMgr.LevelUnlockListNew.Value.Any(x => x.level_ == GameHelper.GetLevel()))
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open);
|
||||
}
|
||||
else
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RainPlayUI_Open);
|
||||
AudioManager.Instance.PlayBGM(AudioConst.GameBg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void openWB(object obj) {
|
||||
SdkConfigMgr.Instance.Open();
|
||||
CreatAnimalCard.instance.SetCameraVisible(false);
|
||||
if (UIManager.Instance.IsExistUI(UIConst.RainPlayUI)) {
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open, false);
|
||||
} else {
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open, true);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
|
||||
}
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.hideBroadCast);
|
||||
}
|
||||
|
||||
#region 缓存资源
|
||||
|
||||
public void GetGalleryNet(int imageID, Action<bool> action = null)
|
||||
{
|
||||
StartCoroutine(TextureHelper.GetGalleryFromNet(imageID, action));
|
||||
}
|
||||
|
||||
#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 BallKingdomCrush
|
||||
{
|
||||
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.wackyllamagame.chaos";
|
||||
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