//是否可以开始游戏 public bool IsCanStartGame(PlayerPosition p, UniInsertCoinsOptionsFile opfile) { if (opfile.chargeMode == UniInsertCoinsOptionsFile.GameChargeMode.Mode_Free) { return(true); } return(GetPlayerInsertCoins(p) >= opfile.coins); }
//游戏开始,扣除游戏币 public override bool GameIsStartChargeCoins(PlayerPosition p, UniInsertCoinsOptionsFile opfile) { if (!GameIsStartChargeCoins(p, opfile)) { return(false); } currentGameTimes[(int)p] = opfile.times; return(true); }
//游戏开始,扣除游戏币 public virtual bool GameIsStartChargeCoins(PlayerPosition p, UniInsertCoinsOptionsFile opfile) { if (!IsCanStartGame(p, opfile)) { return(false); } if (opfile.chargeMode == UniInsertCoinsOptionsFile.GameChargeMode.Mode_Free) { return(true); } SetPlayerInsertCoins(p, GetPlayerInsertCoins(p) - opfile.coins); return(true); }
public static void LoadGameOptionsDefault(UniGameResources gameResources) { try { //加载默认设置 UniGameOptionsFile.LoadGameOptionsDefaultInfo("GameOptions.xml", gameResources); UniInsertCoinsOptionsFile.LoadInsertCoinsOptionsDefaultInfo("InsertCoinsOptions.xml", gameResources); gameOptionsFile = new UniGameOptionsFile(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.PersistentDataPath, "GameOptions\\GameOptions.dat"), gameResources); insertCoinsOptionsFile = new UniInsertCoinsOptionsFile(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.PersistentDataPath, "GameOptions\\InsertCoinsOptions.dat"), gameResources); } catch (System.Exception ex) { UnityEngine.Debug.LogError(ex.ToString()); } }
//返回应该出多少礼品 public int AddScoresAndGivePlayerAward(InsertCoinsAlu.PlayerPosition p, int scores, UniInsertCoinsOptionsFile opfile, UniInsertCoinsRecord recordFile) { totalScores[(int)p] += scores; currentScores[(int)p] += scores; int ret = 0; while (currentScores[(int)p] >= opfile.awardNeedScore) { ret += opfile.awardCount; currentScores[(int)p] -= opfile.awardNeedScore; } if (ret != 0) { GivePlayerAward(p, opfile, recordFile); } return(ret); }
//奖励礼品 public void GivePlayerAward(InsertCoinsAlu.PlayerPosition p, UniInsertCoinsOptionsFile opfile, UniInsertCoinsRecord recordFile) { recordFile.PlayerAward(opfile.awardCount); }