void Start() { DeBug.Log(JsonUtility.ToJson(new AlertDialogJson())); //MobilePlatform.OnInit(); //AllButtonEvent(); }
public static bool CastMark(Obj_AI_Hero target) { if (Config.GetBool("调试")) { DeBug.Debug("[释放技能]", $"目标 {target.Name.ToUTF8()}", DebugLevel.Warning, Output.ChatBox); DeBug.Debug("[释放技能]", $"模式 {Config.GetStringList("预判模式").SelectedValue}", DebugLevel.Warning, Output.ChatBox); DeBug.Debug("[释放技能]", $"命中率 {Config.GetStringList("命中率").SelectedValue}", DebugLevel.Warning, Output.ChatBox); } var hitChangceIndex = Config.GetStringIndex("命中率"); var PredictMode = Config.GetStringIndex("预判模式"); if (PredictMode == 0) { var hitChangceList = new[] { HitChance.VeryHigh, HitChance.High, HitChance.Medium }; return(SnowBall.CastIfHitchanceEquals(target, hitChangceList[hitChangceIndex])); } else if (PredictMode == 1) { var hitChangceList = new[] { SebbyPredict.HitChance.VeryHigh, SebbyPredict.HitChance.High, SebbyPredict.HitChance.Medium }; return(CastSpell(SnowBall, target, hitChangceList[hitChangceIndex])); } return(false); }
/// <summary> /// 检测传入的限制时间是否大于0 /// </summary> /// <param name="r_MaxTime"></param> /// <returns></returns> private bool IsGreaterZero(float r_MaxTime) { if (r_MaxTime > 0) { maxTime = r_MaxTime; return(true); } else { DeBug.LogError("注意:传入的上限时间低于或等于0,无法进行倒计时!"); return(false); } }
/// <summary> /// 保存持久化本地数据类 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static bool SetPrefs <T>(T prefs) where T : class { try { string key = typeof(T).GetType().FullName; string value = JsonUtility.ToJson(prefs); PlayerPrefs.SetString(key, value); //PlayerPrefs.Save(); return(true); } catch (Exception e) { DeBug.LogError(e.ToString()); } return(false); }
private static void WLogic2() { var target = TargetSelector.GetTarget(Q.Range + Q.Width, TargetSelector.DamageType.Magical); if (target == null || !target.IsValid) { return; } var distence = target.Distance(Player); if (W.IsReady() && Config.GetBool("自动W") && (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo || Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed)) { //走向W2 if (distence < 650 && distence > 610 && target.MoveSpeed > Player.MoveSpeed && target.IsFacing(Player) && !IsWActive) { W.Cast(); //350+(600-350)/2 = 350 + 250/2 = 350 + 125 = 475 //350 475 600 DeBug.WriteChatBox("走向W2"); } //处于W2 else if (distence > 590 && distence < 610 && !IsWActive) { W.Cast(); DeBug.WriteChatBox("处于W2"); } //从里走向W2 else if (distence < 590 && distence > 475 && !target.IsFacing(Player) && !IsWActive) { W.Cast(); DeBug.WriteChatBox("从里走向W2"); } //从外走向W1 else if (distence < 475 && distence > 360 && target.IsFacing(Player) && IsWActive) { W.Cast(); DeBug.WriteChatBox("从外走向W1"); } //处于W1内 else if (distence < 360 && IsWActive) { W.Cast(); DeBug.WriteChatBox("处于W1内"); } } }
/// <summary> /// 查找某个子对象的Buttom,并添加点击事件 /// </summary> /// <param name="r_form"></param> /// <param name="r_path"></param> /// <param name="action"></param> /// <returns></returns> public static Button FindOnButton(this Transform r_form, string r_path, UnityAction action) { if (r_form == null) { DeBug.LogError($">>>>>>>>>>> 注意:传入 Transform 为空"); return(null); } Button buttom = r_form.Find(r_path).GetComponent <Button>(); if (buttom == null) { Debug.LogError($">>>>>>>>>>> 注意:查找的子对象没有Buttom组件"); return(null); } buttom?.onClick.AddListener(action); return(buttom); }
// public static T GetTextPrefs<T>() where T : class // { // T temp = default(T); // StreamReader reader = null; // try // { // string txtPath = SetPrefsTxtPath(typeof(T)); // if (File.Exists(txtPath)) // { // reader = new StreamReader(txtPath); // string t = reader.ReadToEnd(); // DeBug.LogOrange($"获取文本流信息:{t}"); // temp = JsonUtility.FromJson<T>(t); // } // } // catch (Exception e) // { // Debug.LogError(e.StackTrace); // } // finally // { // if (reader != null) reader.Close(); // } // return temp; // } // public static void SetTextPrefs<T>(T t) where T : class // { // StreamWriter writer = null; // try // { // string txt = JsonUtility.ToJson(t); // if (!string.IsNullOrEmpty(txt)) // { // string txtPath = SetPrefsTxtPath(typeof(T)); // if (File.Exists(txtPath)) // { // writer = new StreamWriter(txtPath, false); // } // else // { // writer = File.CreateText(txtPath); // } // writer.Write(txt); // DeBug.LogGreen("保存文本流成功:" + txt); // } // } // catch (Exception e) // { // Debug.LogError("保存文本流失败:" + e.StackTrace); // } // finally // { // if (writer != null) writer.Close(); // } // } // private static string SetPrefsTxtPath(Type type) // { //#if UNITY_EDITOR // string prefix = $"{nameof(UnityExpand)}/{type.Namespace}"; // NetExpand.ExistsOfDirectory(prefix); // return $"{prefix}/{type.Name}.txt"; //#elif UNITY_ANDROID || UNITY_IPHONE // string t = type.FullName.Replace(".", "_"); // DeBug.Log(t); // return $"{Application.persistentDataPath}/{t}.txt"; //#endif // } /// <summary> /// 获取持久化本地数据类 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static T GetPrefs <T>() where T : class { T temp = default(T); string key = typeof(T).GetType().FullName; if (PlayerPrefs.HasKey(key)) { try { string value = PlayerPrefs.GetString(key); DeBug.LogGolden(value); temp = JsonUtility.FromJson <T>(value); } catch (Exception e) { DeBug.LogError(e.ToString()); } } return(temp); }
private static void ValidateSentinel(Obj_AI_Base sentinel) { if (sentinel.Health == 2 && sentinel.GetBuffCount("kalistaw") == 1) { DeBug.WriteConsole("[ValidateSentinel]", "进入ValidateSentinel", DebugLevel.Info, Config.Menu.GetBool("调试")); if (!ActiveSentinels.ContainsKey(SentLocation.Item1)) { ActiveSentinels.Add(SentLocation.Item1, new Dictionary <SentinelLocations, Obj_AI_Base>()); DeBug.WriteConsole("[ValidateSentinel]", "不包含这个哨兵", DebugLevel.Info, Config.Menu.GetBool("调试")); } DeBug.WriteConsole("[ValidateSentinel]", "包含这个哨兵", DebugLevel.Info, Config.Menu.GetBool("调试")); ActiveSentinels[SentLocation.Item1].Remove(SentLocation.Item2); ActiveSentinels[SentLocation.Item1].Add(SentLocation.Item2, sentinel); DeBug.WriteConsole("[ValidateSentinel]", "替换哨兵信息", DebugLevel.Info, Config.Menu.GetBool("调试")); SentLocation = null; RecalculateOpenLocations(); DeBug.WriteConsole("[ValidateSentinel]", "方法结束", DebugLevel.Info, Config.Menu.GetBool("调试")); } }
public static void OpenHttpUri(string r_Uri) { if (string.IsNullOrEmpty(r_Uri)) { DeBug.LogRed("注意:输入网址为空"); } else { if (IsAndroid) { Android.ToDevelopUtils(new AlertDialogJson() { type = (int)AlertDialogType.GPS, message = r_Uri, extend = r_Uri, }); } else { } } }
/// <summary> /// /// </summary> /// <param name="r_form"></param> /// <param name="r_path"></param> /// <param name="action"></param> public static ExpandButton FindUserButton(this Transform r_form, string r_path, UnityAction action) { ExpandButton button = null; if (r_form == null) { DeBug.LogError($">>>>>>>>>>> 注意:传入 Transform 为空"); } else { button = r_form.Find(r_path).GetComponent <ExpandButton>(); if (button == null) { Debug.LogError($">>>>>>>>>>> 注意:查找的子对象没有 UserButton 组件"); } else { button?.onClick.AddListener(action); } } return(button); }
/// <summary> 设置微信AppIP AppSecret </summary> public static void SetIWXAPI() { try { if (!HelperBasic.IsNullOrEmpty(WeChat.AppID, WeChat.AppSecret)) { if (IsAndroid) { AndroidJavaClass wecht = new AndroidJavaClass("TencentPlayer.WeChat"); bool isGG = wecht.CallStatic <bool>("setIWXAPI", WeChat.AppID, WeChat.AppSecret); DeBug.Log($"设置微信AppIP AppSecret 是否成功:{isGG}"); } } } catch (Exception e) { Debug.LogError(e); } }
private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender.IsMe) { if (args.SData.Name == "JhinRShotMis") { RCharge.Index++; RCharge.CastT = Game.ClockTime; if (Config.GetBool("调试")) { DeBug.Debug("[OnProcessSpellCast]", $"使用技能R。是否正在放R{IsCastingR}"); } } if (args.SData.Name == "JhinRShotMis4") { RCharge.Index = 0; RCharge.CastT = Game.ClockTime; RCharge.Target = null; if (Config.GetBool("调试")) { DeBug.Debug("[OnProcessSpellCast]", $"使用技能R。是否正在放R{IsCastingR}"); } } } if (sender.IsMe && args.SData.Name == "JhinR") { REndPos = args.End; if (Config.Item("R放眼").GetValue <bool>() && (ScryingOrb.IsReady()) && HeroManager.Enemies.All(e => !e.InRCone() || !e.IsValid || e.IsDead)) { var bushList = VectorHelper.GetBushInRCone(); var lpl = VectorHelper.GetLastPositionInRCone(); if (bushList?.Count > 0) { if (lpl?.Count > 0) { var lp = lpl.First(p => Game.Time - p.LastSeen > 2 * 1000); if (lp != null) { var bush = VectorHelper.GetBushNearPosotion(lp.LastPosition, bushList); ScryingOrb.Cast(bush); } } else { var bush = VectorHelper.GetBushNearPosotion(REndPos, bushList); ScryingOrb.Cast(bush); } } else if (lpl?.Count > 0) { ScryingOrb.Cast(lpl.First().LastPosition); } } } if (sender.IsMe && args.Slot == SpellSlot.W && Config.GetBool("调试")) { DeBug.Debug("[OnProcessSpellCast]", $"使用技能W。是否正在放R{IsCastingR}"); } }
private void PhoneDebug(string r_log) { DeBug.Log("您的手机返回Log:" + r_log); }
/// <summary> /// 这几个步骤应该由后端来做 /// </summary> /// <param name="r_type"></param> /// <param name="r_Url"></param> /// <returns></returns> private IEnumerator CallWXHttps(WXUrl r_type, string r_Url) { DeBug.Log($" 开始CALL ...... {r_type}=> {r_Url}"); WWW wWW = new WWW(r_Url); yield return(wWW); if (wWW.isDone) { if (string.IsNullOrEmpty(wWW.error)) { string data = wWW.text; bool isWrong = false; switch (r_type) { case WXUrl.Access_Token: case WXUrl.Refresh_token: isWrong = weChat.IsError(data); if (!isWrong) { WeChat.Token = JsonUtility.FromJson <AccessToken>(data); StartCoroutine(CallWXHttps(WXUrl.Check_Token, weChat.FullCheckToken())); } break; case WXUrl.Check_Token: { WeChatError error = JsonUtility.FromJson <WeChatError>(data); WXError errorType = weChat.ErrCode(error.errcode); isWrong = errorType != WXError.成功; if (!isWrong) { StartCoroutine(CallWXHttps(WXUrl.GetUnionID, weChat.FullUnionID())); } } break; case WXUrl.GetUnionID: { isWrong = weChat.IsError(data); if (!isWrong) { WeChat.UnionID = JsonUtility.FromJson <WXUnionID>(data); } } break; } if (isWrong) { Debug.LogError($"微信 {r_type} 返回出错:{data}"); } else { DeBug.Log($" 微信 {r_type} 返回正确:{data}"); } } else { Debug.LogError("访问微信Https返回结果出错"); } } }