|
@@ -1,4 +1,5 @@
|
|
|
using System;
|
|
|
+using ET;
|
|
|
using UnityEngine;
|
|
|
|
|
|
namespace GFGGame
|
|
@@ -10,55 +11,40 @@ namespace GFGGame
|
|
|
return false;
|
|
|
}
|
|
|
Debug.LogFormat("init onlineTimeSecs {0} onlineDurationSecs {1} onlineDurationSecsDay{2}", onlineTimeSecs, onlineDurationSecs, onlineDurationSecsDay);
|
|
|
- if(GameGlobal.isVisitor) {
|
|
|
- int remainSecs = 60*60 - onlineDurationSecs;
|
|
|
- if(remainSecs < 0){
|
|
|
- string promptStr = "您当前为游客模式,已被纳入防沉迷系统,在此模式下不能充值和付费消费,共有60分钟体验时间,已全部体验完,需要使用有效的证件进行实名认证才能完整体验游戏内容。";
|
|
|
+ int age = GameGlobal.userAge;
|
|
|
+ if (age < 18)
|
|
|
+ {
|
|
|
+ int remainMinutes = GetRemainGameMinutes();
|
|
|
+ if (remainMinutes <= 0)
|
|
|
+ {
|
|
|
+ string promptStr = "您属于未成年人,已被纳入防沉迷系统。仅可在周五、周六、周日和法定节假日每日20时至21时登录游戏,目前已超出健康游戏体验时间,将强制游戏下线。";
|
|
|
Alert.Show(promptStr)
|
|
|
- .SetRightButton(true, "前往注册", (object data) => {
|
|
|
+ .SetRightButton(true, "知道啦", (object data) => {
|
|
|
GameController.QuitToLoginView(false);
|
|
|
- ViewManager.Show<RegisterView>();
|
|
|
});
|
|
|
return true;
|
|
|
- } else {
|
|
|
- int remainMins = (int)Math.Ceiling(remainSecs/60f);
|
|
|
- string promptStr = "您当前为游客模式,已被纳入防沉迷系统,在此模式下不能充值和付费消费,共有60分钟体验时间,还剩余{0}分钟";
|
|
|
- promptStr = string.Format(promptStr, remainMins);
|
|
|
- Alert.Show(promptStr)
|
|
|
- .SetRightButton(true);
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
- int age = GameGlobal.userAge;
|
|
|
- if(age < 18) {
|
|
|
- int remainSecs = 90*60 - onlineDurationSecsDay;
|
|
|
- if(remainSecs < 0){
|
|
|
- string promptStr = "您属于未成年人,已被纳入防沉迷系统。未成年账号每日累计游戏不得超过90分钟,目前已超出健康游戏体验时间,将强制游戏下线。";
|
|
|
- Alert.Show(promptStr)
|
|
|
- .SetRightButton(true, "知道啦", (object data) => {
|
|
|
- GameController.QuitToLoginView(false);
|
|
|
- });
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- string ageRangeStr = null;
|
|
|
- int maxRechargeSingle = 0;
|
|
|
- int maxRechargeTotal = 0;
|
|
|
- GetAntiValue(out ageRangeStr, out maxRechargeSingle, out maxRechargeTotal);
|
|
|
- int remainMins = (int)Math.Ceiling(remainSecs/60f);
|
|
|
- string promptStr = "您属于{0}未成年人,已被纳入防沉迷系统。每日22:00-次日8:00不得进行游戏;每日在线时间上限为90分钟,目前游戏剩余{1}分钟。";
|
|
|
- promptStr = String.Format(promptStr, ageRangeStr, remainMins);
|
|
|
- if(age < 8) {
|
|
|
- promptStr += "本游戏不为未满8周岁的用户提供游戏充值服务。";
|
|
|
- } else {
|
|
|
- promptStr += "单次充值金额不得超过{0}元人民币,每月充值金额不得超过{1}元人民币。";
|
|
|
- promptStr = String.Format(promptStr, maxRechargeSingle, maxRechargeTotal);
|
|
|
- }
|
|
|
- Alert.Show(promptStr)
|
|
|
- .SetRightButton(true, "知道啦");
|
|
|
+ else
|
|
|
+ {
|
|
|
+ string ageRangeStr = null;
|
|
|
+ int maxRechargeSingle = 0;
|
|
|
+ int maxRechargeTotal = 0;
|
|
|
+ GetAntiValue(out ageRangeStr, out maxRechargeSingle, out maxRechargeTotal);
|
|
|
+ string promptStr = "您属于{0}未成年人,已被纳入防沉迷系统。仅可在周五、周六、周日和法定节假日每日20时至21时登录游戏,目前游戏剩余{1}分钟。";
|
|
|
+ promptStr = String.Format(promptStr, ageRangeStr, remainMinutes);
|
|
|
+ if (age < 8)
|
|
|
+ {
|
|
|
+ promptStr += "本游戏不为未满8周岁的用户提供游戏充值服务。";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ promptStr += "单次充值金额不得超过{0}元人民币,每月充值金额不得超过{1}元人民币。";
|
|
|
+ promptStr = String.Format(promptStr, maxRechargeSingle, maxRechargeTotal);
|
|
|
}
|
|
|
+ Alert.Show(promptStr)
|
|
|
+ .SetRightButton(true, "知道啦");
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -68,32 +54,20 @@ namespace GFGGame
|
|
|
return false;
|
|
|
}
|
|
|
Debug.LogFormat("update onlineTimeSecs {0} onlineDurationSecs {1} onlineDurationSecsDay{2}", onlineTimeSecs, onlineDurationSecs, onlineDurationSecsDay);
|
|
|
- if(GameGlobal.isVisitor) {
|
|
|
- int remainSecs = 60*60 - onlineDurationSecs;
|
|
|
- if(remainSecs < 0) {
|
|
|
- string promptStr = "您当前为游客模式,已被纳入防沉迷系统,在此模式下不能充值和付费消费,共有60分钟体验时间,已全部体验完,需要使用有效的证件进行实名认证才能完整体验游戏内容。";
|
|
|
+ int age = GameGlobal.userAge;
|
|
|
+ if (age < 18)
|
|
|
+ {
|
|
|
+ int remainMinutes = GetRemainGameMinutes();
|
|
|
+ if (remainMinutes <= 0)
|
|
|
+ {
|
|
|
+ string promptStr = "您属于未成年人,已被纳入防沉迷系统。仅可在周五、周六、周日和法定节假日每日20时至21时登录游戏。目前已超出健康游戏体验时间,将强制游戏下线。";
|
|
|
Alert.Show(promptStr)
|
|
|
- .SetRightButton(true, "前往注册", (object data) => {
|
|
|
+ .SetRightButton(true, "知道啦", (object data) => {
|
|
|
GameController.QuitToLoginView(false);
|
|
|
- ViewManager.Show<RegisterView>();
|
|
|
});
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- int age = GameGlobal.userAge;
|
|
|
- if(age < 18) {
|
|
|
- int remainSecs = 90*60 - onlineDurationSecsDay;
|
|
|
- if(remainSecs < 0) {
|
|
|
- string promptStr = "您属于未成年人,已被纳入防沉迷系统。未成年账号每日累计游戏不得超过90分钟,目前已超出健康游戏体验时间,将强制游戏下线。";
|
|
|
- Alert.Show(promptStr)
|
|
|
- .SetRightButton(true, "知道啦", (object data) => {
|
|
|
- GameController.QuitToLoginView(false);
|
|
|
- });
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -103,7 +77,8 @@ namespace GFGGame
|
|
|
return false;
|
|
|
}
|
|
|
string promptStr = "";
|
|
|
- if(GameGlobal.isVisitor) {
|
|
|
+ if (GameGlobal.isVisitor)
|
|
|
+ {
|
|
|
promptStr += "您当前为游客模式,已被纳入防沉迷系统,在此模式下不能充值和付费消费。";
|
|
|
Alert.Show(promptStr)
|
|
|
.SetRightButton(true, "知道啦");
|
|
@@ -116,14 +91,18 @@ namespace GFGGame
|
|
|
promptStr = "您属于{0}未成年人,已被纳入防沉迷系统。";
|
|
|
promptStr = String.Format(promptStr, ageRangeStr);
|
|
|
int age = GameGlobal.userAge;
|
|
|
- if(age < 8) {
|
|
|
+ if (age < 8)
|
|
|
+ {
|
|
|
promptStr += "本游戏不为未满8周岁的用户提供游戏充值服务。";
|
|
|
Alert.Show(promptStr)
|
|
|
.SetRightButton(true, "知道啦");
|
|
|
return true;
|
|
|
- } else if(age < 18) {
|
|
|
+ }
|
|
|
+ else if (age < 18)
|
|
|
+ {
|
|
|
int preTotalMon = RoleDataManager.rechargeTotalMon + value;
|
|
|
- if(value > maxRechargeSingle || preTotalMon > maxRechargeTotal) {
|
|
|
+ if (value > maxRechargeSingle || preTotalMon > maxRechargeTotal)
|
|
|
+ {
|
|
|
promptStr += "单次充值金额不得超过{0}元人民币,每月充值金额不得超过{1}元人民币。";
|
|
|
promptStr = String.Format(promptStr, maxRechargeSingle, maxRechargeTotal);
|
|
|
Alert.Show(promptStr)
|
|
@@ -136,20 +115,40 @@ namespace GFGGame
|
|
|
|
|
|
private static void GetAntiValue(out string ageRangeStr, out int maxRechargeSingle, out int maxRechargeTotal) {
|
|
|
int age = GameGlobal.userAge;
|
|
|
- if(age < 8){
|
|
|
+ if (age < 8)
|
|
|
+ {
|
|
|
ageRangeStr = "未满8周岁";
|
|
|
maxRechargeSingle = 0;
|
|
|
maxRechargeTotal = 0;
|
|
|
- } else if(age < 16){
|
|
|
+ }
|
|
|
+ else if (age < 16)
|
|
|
+ {
|
|
|
ageRangeStr = "8周岁以上未满16周岁";
|
|
|
maxRechargeSingle = 50;
|
|
|
maxRechargeTotal = 200;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
ageRangeStr = "16周岁以上未满18周岁";
|
|
|
maxRechargeSingle = 100;
|
|
|
maxRechargeTotal = 400;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 防沉迷对象当日剩余可玩时间
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private static int GetRemainGameMinutes()
|
|
|
+ {
|
|
|
+ var dateTime = TimeHelper.DateTimeNow();
|
|
|
+ int hour = dateTime.Hour;
|
|
|
+ if (hour >= 20 && hour < 21)
|
|
|
+ {
|
|
|
+ int minute = dateTime.Minute;
|
|
|
+ return 60 - minute;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|