备份CatanBuilding瘦身独立工程
This commit is contained in:
780
Assets/Scripts/SandDig/DiggingGameManager.cs
Normal file
780
Assets/Scripts/SandDig/DiggingGameManager.cs
Normal file
@@ -0,0 +1,780 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using Cinemachine;
|
||||
using game;
|
||||
using GameCore;
|
||||
using Script.RuntimeScript.ExplosionEffect;
|
||||
using Script.RuntimeScript.model.Data;
|
||||
using UnityEngine;
|
||||
using UniRx;
|
||||
using Game;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Script.RuntimeScript
|
||||
{
|
||||
public class DiggingGameManager
|
||||
{
|
||||
/// <summary>
|
||||
/// 沙滩寻宝 测试 log 开启关闭
|
||||
/// </summary>
|
||||
private const bool LogOpen = false;
|
||||
|
||||
private MonoBehaviour _monoBehaviour;
|
||||
public MonoBehaviour BaseMono => _monoBehaviour;
|
||||
|
||||
private DiggingGameModel _dataModel;
|
||||
public DiggingGameModel DataModel => _dataModel;
|
||||
|
||||
private Animation _digAni;
|
||||
|
||||
private CinemachineVirtualCamera _cameraVir;
|
||||
|
||||
|
||||
private GameObject fx_DgSanddig;
|
||||
private GameObject fx_DgSanddighard;
|
||||
/// <summary>
|
||||
/// 通关爆炸动画
|
||||
/// </summary>
|
||||
private GameObject fx_DgSanddisappear;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏状态
|
||||
/// </summary>
|
||||
private SandDigGameState _gameState = SandDigGameState.Normal;
|
||||
public SandDigGameState GameState
|
||||
{
|
||||
get { return _gameState; }
|
||||
set
|
||||
{
|
||||
DiggingGameManager.LogError("沙滩寻宝状态:" + value.ToString());
|
||||
_gameState = value;
|
||||
}
|
||||
}
|
||||
public bool IsCanClick = true;
|
||||
/// <summary>
|
||||
/// 棋盘
|
||||
/// </summary>
|
||||
private GameBroadLogic _broadLogic;
|
||||
public GameBroadLogic BroadLogic => _broadLogic;
|
||||
/// <summary>
|
||||
/// 棋盘格子背景容器
|
||||
/// </summary>
|
||||
private GameObject _broadContainer;
|
||||
public GameObject BroadContainer => _broadContainer;
|
||||
/// <summary>
|
||||
/// 棋盘格子容器
|
||||
/// </summary>
|
||||
private GameObject _gridContianer;
|
||||
public GameObject GridContainer => _gridContianer;
|
||||
/// <summary>
|
||||
/// 棋盘格子中道具容器
|
||||
/// </summary>
|
||||
private GameObject _gridPropContianer;
|
||||
public GameObject GridPropContainer => _gridPropContianer;
|
||||
/// <summary>
|
||||
/// 宝箱道具容器
|
||||
/// </summary>
|
||||
private GameObject _propContainer;
|
||||
public GameObject PropContainer => _propContainer;
|
||||
|
||||
private GameObject _showPropPositon;
|
||||
public GameObject ShowPropPositon => _showPropPositon;
|
||||
GameObject _DgSand_bgend => _bgSandBg?.DgSand_bgend;
|
||||
private Tables _tables;
|
||||
public Tables TableData => _tables;
|
||||
|
||||
/// <summary>
|
||||
/// 爆炸管理器
|
||||
/// </summary>
|
||||
private ExplosionManager _explosionManager;
|
||||
public ExplosionManager ExplosionManager => _explosionManager;
|
||||
|
||||
/// <summary>
|
||||
/// 管卡是否通过
|
||||
/// </summary>
|
||||
public bool ClampIsPass = false;
|
||||
public List<ItemData> itemDatas;
|
||||
//奖励界面是否打开
|
||||
private bool _awardPanelIsOpen = false;
|
||||
|
||||
Sound sanddig_dig_sound;
|
||||
|
||||
AudioClip sanddig_dig_audio;
|
||||
AudioClip sanddig_dighard_audio;
|
||||
|
||||
DgSandBg _bgSandBg;
|
||||
|
||||
Transform _fxRoot;
|
||||
|
||||
public async System.Threading.Tasks.Task InitGame(MonoBehaviour monoBehaviour, CinemachineVirtualCamera camera, GameObject broadContainer, GameObject gridContainer, GameObject gridPropContianer, GameObject propContainer, GameObject showPropPositon, Transform fxRoot)
|
||||
{
|
||||
await _dataModel.InitServerData();
|
||||
IniTable();
|
||||
AddEventLister();
|
||||
AudioLoad();
|
||||
_monoBehaviour = monoBehaviour;
|
||||
_cameraVir = camera;
|
||||
_broadContainer = broadContainer;
|
||||
_gridContianer = gridContainer;
|
||||
_gridPropContianer = gridPropContianer;
|
||||
_propContainer = propContainer;
|
||||
_showPropPositon = showPropPositon;
|
||||
_fxRoot = fxRoot;
|
||||
_explosionManager = new ExplosionManager();
|
||||
_explosionManager.Init();
|
||||
await _dataModel.InitClientData(ClientDataHandleEnum.EnterGame);
|
||||
await LoadGameObject();
|
||||
}
|
||||
async System.Threading.Tasks.Task LoadGameObject()
|
||||
{
|
||||
if (_broadLogic == null)
|
||||
{
|
||||
_broadLogic = new GameBroadLogic();
|
||||
}
|
||||
bool IsPassAll = IsPassAllClamps();
|
||||
DiggingActivityInit digActivityConfig = _dataModel.digActivityConfig;
|
||||
GameObject bg = await _broadLogic.LoadGameObject(digActivityConfig.Bg, _cameraVir.transform);
|
||||
if (bg != null)
|
||||
{
|
||||
_bgSandBg = bg.GetComponent<DgSandBg>();
|
||||
_DgSand_bgend?.SetActive(IsPassAll);
|
||||
}
|
||||
if (!IsPassAll)
|
||||
{
|
||||
Transform boxRoot = _propContainer.transform.Find("Box");
|
||||
int count = boxRoot.childCount;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//宝箱加载
|
||||
_ = _broadLogic.LoadGameObject(digActivityConfig.DiggingBoxList[i], boxRoot.GetChild(i));
|
||||
}
|
||||
GameObject dig = await _broadLogic.LoadGameObject(digActivityConfig.Shovel, _monoBehaviour.transform);
|
||||
if (dig != null)
|
||||
{
|
||||
_digAni = dig.GetComponent<Animation>();
|
||||
_digAni.gameObject.SetActive(false);
|
||||
}
|
||||
fx_DgSanddig = await Addressables.LoadAssetAsync<GameObject>(digActivityConfig.DiggingGridFxDg).Task;
|
||||
fx_DgSanddighard = await Addressables.LoadAssetAsync<GameObject>(digActivityConfig.DiggingGridFxDh).Task;
|
||||
fx_DgSanddisappear = await Addressables.LoadAssetAsync<GameObject>(digActivityConfig.DiggingGridFxDs).Task;
|
||||
}
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
_explosionManager.Reset();
|
||||
RemoveEventLister();
|
||||
AudioRelease();
|
||||
if (fx_DgSanddig != null)
|
||||
{
|
||||
Addressables.Release(fx_DgSanddig);
|
||||
}
|
||||
if (fx_DgSanddighard != null)
|
||||
{
|
||||
Addressables.Release(fx_DgSanddighard);
|
||||
}
|
||||
if (fx_DgSanddisappear != null)
|
||||
{
|
||||
Addressables.Release(fx_DgSanddisappear);
|
||||
}
|
||||
}
|
||||
private IDisposable _onCloseAwardPanel = null;
|
||||
void AddEventLister()
|
||||
{
|
||||
RemoveEventLister();
|
||||
_onCloseAwardPanel = GContext.OnEvent<RewardPanelClose>().Subscribe(OnCloseAwardPanel);
|
||||
}
|
||||
|
||||
void RemoveEventLister()
|
||||
{
|
||||
_onCloseAwardPanel?.Dispose();
|
||||
_onCloseAwardPanel = null;
|
||||
}
|
||||
async void AudioLoad()
|
||||
{
|
||||
AudioRelease();
|
||||
GContext.Publish(new EventBGMSound(_dataModel.digActivityConfig.Bgm));
|
||||
|
||||
sanddig_dig_audio = await Addressables.LoadAssetAsync<AudioClip>("audio_ui_sanddig_dig").Task;
|
||||
sanddig_dighard_audio = await Addressables.LoadAssetAsync<AudioClip>("audio_ui_sanddig_dighard").Task;
|
||||
sanddig_dig_sound = GContext.container.Resolve<ISoundService>().GetNewUISound(sanddig_dig_audio);
|
||||
}
|
||||
void AudioRelease()
|
||||
{
|
||||
sanddig_dig_sound?.ReturnPool();
|
||||
sanddig_dig_sound = null;
|
||||
if (sanddig_dig_audio != null)
|
||||
{
|
||||
Addressables.Release(sanddig_dig_audio);
|
||||
sanddig_dig_audio = null;
|
||||
}
|
||||
if (sanddig_dighard_audio != null)
|
||||
{
|
||||
Addressables.Release(sanddig_dighard_audio);
|
||||
sanddig_dighard_audio = null;
|
||||
}
|
||||
}
|
||||
public void IniTable()
|
||||
{
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
}
|
||||
|
||||
public void InitServerData(Dictionary<string, string> userDatas = null)
|
||||
{
|
||||
if (_dataModel == null)
|
||||
{
|
||||
_dataModel = new DiggingGameModel();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (_broadLogic != null)
|
||||
{
|
||||
_broadLogic.Update();
|
||||
}
|
||||
switch (_gameState)
|
||||
{
|
||||
case SandDigGameState.Normal:
|
||||
break;
|
||||
case SandDigGameState.LoadJson:
|
||||
break;
|
||||
case SandDigGameState.LoadJsonOver:
|
||||
_gameState = SandDigGameState.Begin;
|
||||
break;
|
||||
case SandDigGameState.Begin: //开始游戏
|
||||
_gameState = SandDigGameState.Going;
|
||||
BeginGame();
|
||||
break;
|
||||
case SandDigGameState.Going: //游戏进行中
|
||||
break;
|
||||
case SandDigGameState.PropEffect: //挖出道具动画阶段
|
||||
break;
|
||||
case SandDigGameState.PropEffectEnd: //道具动画播放结束
|
||||
if (ClampIsPass)
|
||||
{
|
||||
_gameState = SandDigGameState.Pass;
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameState = SandDigGameState.Going;
|
||||
}
|
||||
break;
|
||||
case SandDigGameState.Pass: //通关
|
||||
DiggingGameManager.LogError("执行通关逻辑 !!");
|
||||
_gameState = SandDigGameState.Normal;
|
||||
//数据再 model passClamp 中已经存储,这里显示奖励
|
||||
//GContext.Publish(new ShowData());
|
||||
_awardPanelIsOpen = true;
|
||||
|
||||
_dataModel.NewClampInit();
|
||||
|
||||
break;
|
||||
case SandDigGameState.WaitPassLoading:
|
||||
if (!_awardPanelIsOpen)
|
||||
{
|
||||
ShowLoadingEffect();
|
||||
}
|
||||
break;
|
||||
case SandDigGameState.Loading:
|
||||
break;
|
||||
case SandDigGameState.LoadingOver:
|
||||
//开始
|
||||
_gameState = SandDigGameState.Begin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowFX(string fxName, bool show)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fxName) || _fxRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Transform transform = _fxRoot.Find(fxName);
|
||||
if (transform != null)
|
||||
{
|
||||
transform.gameObject.SetActive(show);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowFX(GridEffectType GridEffectType, Transform parent)
|
||||
{
|
||||
GameObject go = null;
|
||||
switch (GridEffectType)
|
||||
{
|
||||
case GridEffectType.ClickDig:
|
||||
case GridEffectType.DoubleClick:
|
||||
if (fx_DgSanddig != null)
|
||||
{
|
||||
Transform tran = parent.Find(fx_DgSanddig.name);
|
||||
if (tran == null)
|
||||
{
|
||||
go = GameObject.Instantiate(fx_DgSanddig, parent);
|
||||
go.name = fx_DgSanddig.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
go = tran.gameObject;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GridEffectType.ClickBigDig:
|
||||
if (fx_DgSanddighard != null)
|
||||
{
|
||||
go = GameObject.Instantiate(fx_DgSanddighard, parent);
|
||||
go.name = fx_DgSanddighard.name;
|
||||
}
|
||||
break;
|
||||
case GridEffectType.PassiveBomb:
|
||||
case GridEffectType.PassiveClear:
|
||||
case GridEffectType.PassClamp:
|
||||
if (fx_DgSanddisappear != null)
|
||||
{
|
||||
go = GameObject.Instantiate(fx_DgSanddisappear, parent);
|
||||
go.name = fx_DgSanddisappear.name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (go != null)
|
||||
{
|
||||
go.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示挖掘动画
|
||||
/// </summary>
|
||||
int digShowCount = 0;
|
||||
public async void ShowDigEffect(ClickDigType type, Vector3 pos)
|
||||
{
|
||||
digShowCount++;
|
||||
pos.z = -2;
|
||||
if (_digAni != null)
|
||||
{
|
||||
_digAni.transform.position = pos;
|
||||
_digAni.gameObject.SetActive(true);
|
||||
DiggingActivityInit digActivityConfig = _dataModel.digActivityConfig;
|
||||
|
||||
if (type == ClickDigType.Smail)
|
||||
{
|
||||
_digAni.Play(digActivityConfig.DiggingShovelFxDg);
|
||||
}
|
||||
else
|
||||
{
|
||||
_digAni.Play(digActivityConfig.DiggingShovelFxDh);
|
||||
}
|
||||
}
|
||||
int delay = 200;
|
||||
if (type == ClickDigType.Smail)
|
||||
{
|
||||
await System.Threading.Tasks.Task.Delay(SandDigEventConst.ShovelAnimTime - delay);
|
||||
//GContext.Publish(new EventUISound("audio_ui_sanddig_dig"));
|
||||
if (sanddig_dig_sound != null)
|
||||
{
|
||||
sanddig_dig_sound.audioSource.clip = sanddig_dig_audio;
|
||||
sanddig_dig_sound.audioSource.Play();
|
||||
}
|
||||
await System.Threading.Tasks.Task.Delay(delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
await System.Threading.Tasks.Task.Delay(SandDigEventConst.BigShovelAnimTime - delay);
|
||||
//GContext.Publish(new EventUISound("audio_ui_sanddig_dighard"));
|
||||
if (sanddig_dig_sound != null)
|
||||
{
|
||||
sanddig_dig_sound.audioSource.clip = sanddig_dighard_audio;
|
||||
sanddig_dig_sound.audioSource.Play();
|
||||
}
|
||||
await System.Threading.Tasks.Task.Delay(delay);
|
||||
}
|
||||
digShowCount--;
|
||||
if (digShowCount <= 0 && _digAni != null)
|
||||
{
|
||||
_digAni.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void BeginGame()
|
||||
{
|
||||
ClampIsPass = false;
|
||||
if (_broadLogic == null)
|
||||
{
|
||||
_broadLogic = new GameBroadLogic();
|
||||
}
|
||||
else
|
||||
{
|
||||
_broadLogic.Reset();
|
||||
}
|
||||
|
||||
int broadWidth = GetBroadWidth();
|
||||
int broadHeight = GetBroadHeight();
|
||||
Vector3 cameraPos = _cameraVir.transform.position;
|
||||
|
||||
DiggingDisplayInit diplayConfig = TableData.TbDiggingDisplayInit.GetOrDefault(broadHeight);
|
||||
if (diplayConfig != null)
|
||||
{
|
||||
cameraPos.y = diplayConfig.VirtualCameraY;
|
||||
}
|
||||
|
||||
_cameraVir.transform.position = new Vector3(broadWidth * 0.5f, cameraPos.y, cameraPos.z);
|
||||
DiggingGameManager.LogError("当前管卡Id:::" + _dataModel.GetCurClampId() + " 棋盘宽度::" + broadWidth);
|
||||
if (_dataModel.GetCurClampId() > 0)
|
||||
{
|
||||
_broadLogic.InitEvent();
|
||||
_broadLogic.BuildBroadBack();
|
||||
_broadLogic.BuildGrid();
|
||||
_broadLogic.BuildProp();
|
||||
_broadLogic.BuildTempProp();
|
||||
_dataModel.SaveAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCloseAwardPanel(RewardPanelClose data)
|
||||
{
|
||||
//if (data.rewardType != RewardType.Destroy) return;
|
||||
_awardPanelIsOpen = false;
|
||||
if (_gameState == SandDigGameState.WaitPassLoading)
|
||||
{
|
||||
ShowLoadingEffect();
|
||||
}
|
||||
else if (IsPassAllClamps())
|
||||
{
|
||||
//通关所有关卡
|
||||
DiggingGameManager.LogError("通关所有关卡!!!!!!!");
|
||||
_broadLogic.Reset();
|
||||
HidBox();
|
||||
_DgSand_bgend?.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
public void GMSetClamp(int index)
|
||||
{
|
||||
_dataModel.GMSetClamp(index);
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示转场动画
|
||||
/// </summary>
|
||||
private async void ShowLoadingEffect()
|
||||
{
|
||||
_gameState = SandDigGameState.Loading;
|
||||
await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
|
||||
await System.Threading.Tasks.Task.Delay(500);
|
||||
|
||||
_gameState = SandDigGameState.LoadingOver;
|
||||
GContext.Publish(new EndTransition());
|
||||
|
||||
}
|
||||
|
||||
public int GetActivityId()
|
||||
{
|
||||
return GContext.container.Resolve<FishingEventData>().GetEvent(4, 1);
|
||||
}
|
||||
public FishingEvent GetActivityConfig(int acId)
|
||||
{
|
||||
return GContext.container.Resolve<Tables>().TbFishingEvent.Get(acId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前管卡 是当前活动的第几关
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetCurClampIndex()
|
||||
{
|
||||
List<int> allClamps = _dataModel.digActivityConfig.StageList;
|
||||
int curClampId = _dataModel.GetCurClampId();
|
||||
if (curClampId < 0)
|
||||
{
|
||||
return allClamps.Count - 1;
|
||||
}
|
||||
return allClamps.IndexOf(curClampId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取当前活动所有管卡数量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetAllClampCount()
|
||||
{
|
||||
List<int> allClamps = _dataModel.digActivityConfig.StageList;
|
||||
return allClamps.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过全部管卡
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsPassAllClamps()
|
||||
{
|
||||
return _dataModel.GetServerData().ClampId < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取活动道具id
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetActivityPropId()
|
||||
{
|
||||
return _dataModel.digActivityConfig.TokenID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取棋盘宽度
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetBroadWidth()
|
||||
{
|
||||
BroadData[] allGrid = DataModel.GetAllBroadData();
|
||||
int widthCount = 0;
|
||||
for (int i = 0; i < allGrid.Length; i++)
|
||||
{
|
||||
if ((int)allGrid[i].LocalPos.y == 1)
|
||||
{
|
||||
widthCount++;
|
||||
}
|
||||
}
|
||||
return widthCount + 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取棋盘高度
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetBroadHeight()
|
||||
{
|
||||
BroadData[] allGrid = DataModel.GetAllBroadData();
|
||||
int widthCount = 0;
|
||||
for (int i = 0; i < allGrid.Length; i++)
|
||||
{
|
||||
if ((int)allGrid[i].LocalPos.x == 1)
|
||||
{
|
||||
widthCount++;
|
||||
}
|
||||
}
|
||||
return widthCount + 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取棋子宽度数量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetGridWidth()
|
||||
{
|
||||
GridData[] allGrid = DataModel.GetAllGridData();
|
||||
int minX = 0;
|
||||
int maxX = 0;
|
||||
for (int i = 0; i < allGrid.Length; i++)
|
||||
{
|
||||
if (allGrid[i].LocalPos.x < minX)
|
||||
{
|
||||
minX = (int)Math.Round(allGrid[i].LocalPos.x);
|
||||
}
|
||||
|
||||
if (allGrid[i].LocalPos.x > maxX)
|
||||
{
|
||||
maxX = (int)Math.Round(allGrid[i].LocalPos.x);
|
||||
}
|
||||
}
|
||||
return maxX - minX;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取已经获得的目标道具
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<int> GetHasPassPropIds()
|
||||
{
|
||||
return DataModel.GetServerData().PassPropIds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加道具
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
public void AddDigCount(int count)
|
||||
{
|
||||
_dataModel.AddDigCount(count);
|
||||
}
|
||||
public void ClearPropContianer()
|
||||
{
|
||||
foreach (Transform child in _propContainer.transform)
|
||||
{
|
||||
if (child && child.name != "Box")
|
||||
GameObject.Destroy(child.gameObject);
|
||||
}
|
||||
}
|
||||
public void DgSandBox()
|
||||
{
|
||||
DiggingStageReward config = GContext.container.Resolve<Tables>().TbDiggingStageReward.Get(_dataModel.GetServerData().ClampId);
|
||||
Transform boxRoot = _propContainer.transform.Find("Box");
|
||||
int count = boxRoot.childCount;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Transform box = boxRoot.GetChild(i);
|
||||
box.gameObject.SetActive(box.name == config.StageBox);
|
||||
}
|
||||
}
|
||||
void HidBox()
|
||||
{
|
||||
Transform boxRoot = _propContainer.transform.Find("Box");
|
||||
int count = boxRoot.childCount;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Transform box = boxRoot.GetChild(i);
|
||||
box.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
public int GetCurLevel()
|
||||
{
|
||||
List<int> allClamps = _dataModel.digActivityConfig.StageList;
|
||||
int level = allClamps.Count;
|
||||
int curClampId = _dataModel.GetCurClampId();
|
||||
if (curClampId > 0)
|
||||
{
|
||||
level = allClamps.IndexOf(curClampId) + 1;
|
||||
}
|
||||
return level;
|
||||
}
|
||||
/// <summary>
|
||||
/// 沙滩寻宝打点
|
||||
/// </summary>
|
||||
public void SandDigPoint(GridType gridType, int level, int clickCount)
|
||||
{
|
||||
int type = 0;
|
||||
switch (gridType)
|
||||
{
|
||||
case GridType.Normal:
|
||||
type = 1;
|
||||
break;
|
||||
case GridType.Resource:
|
||||
type = 3;
|
||||
break;
|
||||
case GridType.Special:
|
||||
type = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
#if AGG
|
||||
using (var e = GEvent.GameEvent("beachcomb"))
|
||||
{
|
||||
e.AddContent("grid_type", type) //格子类型 空格子=0,普通格子=1,特殊事件=2,资源道具=3
|
||||
.AddContent("stage_lv", level) //关卡等级
|
||||
.AddContent("click_times", clickCount) //点击次数
|
||||
.AddContent("stage_clear", ClampIsPass ? 1 : 0); //关卡完成情况 未完成=0,完成=1
|
||||
|
||||
if (itemDatas != null && itemDatas.Count > 0 && ClampIsPass == true)
|
||||
{
|
||||
for (int i = 0; i < itemDatas.Count; i++)
|
||||
{
|
||||
if (itemDatas[i].id == 1001)
|
||||
{
|
||||
e.AddContent("reward_hook", itemDatas[i].count);
|
||||
}
|
||||
else if (itemDatas[i].id == 1002)
|
||||
{
|
||||
e.AddContent("reward_cash", itemDatas[i].count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void LogWarning(string value)
|
||||
{
|
||||
if (!LogOpen) return;
|
||||
|
||||
Debug.Log("<color=#ffff00>沙滩寻宝: " + value + "</color>");
|
||||
}
|
||||
|
||||
public static void LogError(string value)
|
||||
{
|
||||
if (!LogOpen) return;
|
||||
Debug.Log("<color=#00ff00>沙滩寻宝: " + value + "</color>");
|
||||
}
|
||||
|
||||
public bool NewInfo()
|
||||
{
|
||||
int id = _dataModel.CurActivityId;
|
||||
int oldId = PlayerPrefs.GetInt("DigGridData", -1);
|
||||
if (id == oldId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PlayerPrefs.SetInt("DigGridData", id);
|
||||
//PlayerPrefs.Save();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 资源路径类型
|
||||
/// </summary>
|
||||
public enum UrlType
|
||||
{
|
||||
Broad,
|
||||
Grid,
|
||||
GridProp,
|
||||
Prop,
|
||||
SpecialEvent
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// grid 动画类型
|
||||
/// </summary>
|
||||
public enum GridEffectType
|
||||
{
|
||||
ClickDig, //普通挖掘
|
||||
ClickBigDig, //挖出道具
|
||||
DoubleClick, //需要点击两次
|
||||
PassiveBomb, //特殊事件触发 爆炸
|
||||
PassiveClear, //特殊事件触发 消除
|
||||
PassClamp, //通关
|
||||
}
|
||||
|
||||
public enum SandDigGameState
|
||||
{
|
||||
Normal,
|
||||
Begin,
|
||||
Going,
|
||||
LoadJson,
|
||||
LoadJsonOver,
|
||||
WaveEffect,
|
||||
PropEffect,
|
||||
PropEffectEnd,
|
||||
Pass, //通关
|
||||
WaitPassLoading, //准备转场
|
||||
Loading, //转场中
|
||||
LoadingOver,
|
||||
}
|
||||
|
||||
public enum GridMeshType
|
||||
{
|
||||
None,
|
||||
Mesh1,
|
||||
Mesh2,
|
||||
}
|
||||
|
||||
public enum ClickDigType
|
||||
{
|
||||
Smail,
|
||||
Big,
|
||||
}
|
||||
|
||||
public enum ClientDataHandleEnum
|
||||
{
|
||||
Init,
|
||||
PassClamp,
|
||||
EnterGame
|
||||
}
|
||||
|
||||
public enum GridType
|
||||
{
|
||||
Normal,
|
||||
Resource,
|
||||
Special,
|
||||
None
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user