private void OnAssetReady(string assetname, GameObject obj, bool isSuccessed) { if (!isSuccessed) { EB.Debug.LogError(string.Format("Asset {0} dont find", assetname)); } else { if (this == null) { EB.Debug.LogError("<color=#ff0000>加载的资源完成的~发现寄主对象已经不存在了,就直接清除掉刚才加载的对象:</color>" + assetname); Destroy(obj); } else { if (IsHeroStartEffect(obj.name)) { GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "BossParticleInSceneComplete"); } if (!_fxParticleList.Contains(obj)) { _fxParticleList.Add(obj); } } } TimerManager.instance.AddFramer(0, 1, RegisterFxParticles, obj); loadingAssetCount--; }
public static void InitArmyPostion(Army army, int xw, int yw, int type) { //TODO: replace this magic numbers (200/160) by screen width/height or something var x1 = xw * 200; var y1 = yw * 160; foreach (var character in army.Characters) { if (type == 1) { var xw2 = 0; var yw2 = 0; do { xw2 = GlobalUtils.Rand(3); yw2 = GlobalUtils.Rand(3); } while (xw2 != xw && yw2 != yw); x1 = xw2 * 200; y1 = yw2 * 160; } else if (type == 2) { x1 = GlobalUtils.Rand(3) * 200; } else if (type == 3) { y1 = GlobalUtils.Rand(3) * 160; } do { character.X = GlobalUtils.Rand(200) + x1 + 16; character.Y = GlobalUtils.Rand(160) + y1 + 20; } while (false); //TODO: while there is no other things in that position } }
private void btnSaveAll_Click(object sender, EventArgs e) { if (_model == null) { return; } string path = GlobalUtils.OpenBrowseFolderDlg(); if (string.IsNullOrEmpty(path)) { return; } int res = PassportPicHandler.DownloadSelectedTypes(_model.PassportNo, path); if (res > 0) { if (MessageBoxEx.Show("保存成功,是否打开所在文件夹?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start(path); } } else { MessageBoxEx.Show("保存失败"); } }
public void Start() { //ToDo:暂时屏蔽,方便解耦 //LTMainMenuHudController.Instance.gameObject.SetActive(false); GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.LTMainMenuHudController", "SetActiveFromILR", false); Stop(); }
private void PrepareDictionaries(Language language, string description, string descriptionId, DateTime?date, long?dayTime) { var cultureName = new CultureInfo(language == Language.English ? "en-US" : "pl-PL"); if (dayTime == null) { dayTimeDict.Add(language, language == Language.Polish ? "Teraz" : "Now"); } else { dayTimeDict.Add(language, (GlobalUtils.UnixTimeStampToDateTime(dayTime.Value) + DateTimeOffset.Now.Offset).ToString("HH:mm")); } if (language == Language.Polish) { descriptionDict.Add(language, description.FirstOrDefault().ToString().ToUpper() + description.Substring(1)); } else { descriptionDict.Add(language, descriptionId != null ? GlobalUtils.GetDescriptionFromId(descriptionId) : string.Empty); } if (date != null) { weekDayDict.Add(language, cultureName.DateTimeFormat.GetDayName(date.Value.DayOfWeek).FirstOrDefault().ToString().ToUpper() + cultureName.DateTimeFormat.GetDayName(date.Value.DayOfWeek).Substring(1)); dateDict.Add(language, date.Value.ToString("dd MMMM", cultureName).First() == '0' ? date.Value.ToString("dd MMMM", cultureName).Remove(0, 1) : date.Value.ToString("dd MMMM", cultureName)); } }
private void HandleArmyCurrentAction(Army army) { switch (army.CurrentAction) { case ArmyActions.Move: case ArmyActions.FastMove: case ArmyActions.Attack: if (!army.Owner.IsUserControlled && GlobalUtils.Rand(6) == 1) { GiveTheOrder(army); return; } Move(army); break; case ArmyActions.Camping: //TODO: MA_OBOZ[A] // don't skip camping if not user army if (!army.Owner.IsUserControlled) { GiveTheOrder(army); } break; case ArmyActions.Hunting: //TODO: MA_POLOWANIE[A] break; } }
// set the facing of the player and the current talker private void SetDefaultFacing(Dialogue.DialogueData.DialoguePoint dialoguePoint) { if (null == dialoguePoint || // we can't do anything without a dialogue point dialoguePoint.actions.ContainsFacingActions() || // if this step has facing actions, then don't do anything here IsDuringGameplay()) // if this is a speech bubble conversation during gameplay, we're not gonna set facing { return; } GameObject caller = GlobalUtils.FindCharacter(dialoguePoint.caller); if (null == caller) // if we can't find the character to use { return; } GameObject player = PlayerManager.LocalPlayerGameObject(); if (null == player) // if we have no player we don't know who to look at { return; } if (caller != player) { FacingAction.OrientFacing(caller, player); } }
private void ProcessPopulation(City city) { if (city.Owner != null) { if (city.Owner.IsUserControlled) { var population = city.Population + (city.Craziness - city.Tax); var morale = city.Morale + (city.Craziness - city.Tax); if (morale > 150) { morale = 150; } if (population < 30) { population = 30; } city.Population = population; city.Morale = morale; if (morale <= 0) { _cityIncidents.Riot(city); } } else { city.Population += GlobalUtils.Rand(10) - 2; } } }
/// <summary> /// 销毁Controller /// </summary> private void DestroyController() { if (IsDestroyed(this)) { return; } if (gameObject != null) { EB.Debug.LogUI("执行【<color=#00ff00>{0}</color>】预设<color=#ff0000>清除UI</color>界面对象", gameObject.name); } StopAllCoroutines(); if (ShowUIBlocker) { mTrigger = null; mCollider = null; mBlocker = null; } mParam = null; Show(false); DestroyObject(); //ToDo:暂时屏蔽 //if (GlobalMenuManager.Instance != null) //{ // GlobalMenuManager.Instance.RemoveOpenController(this); //} GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "RemoveOpenControllerFromILR", this); }
/// <summary> /// 某个界面管理器是否被删除了 /// </summary> /// <param name="ui"></param> /// <returns></returns> public static bool IsDestroyed(UIController ui) { if (ui == null) { return(true); } bool isDestroyed = false; UIPanel panel = ui.GetComponent <UIPanel>(); if (panel == null) { isDestroyed = ui.gameObject.activeSelf; } else { //isDestroyed = !panel.enabled; isDestroyed = false; } if (isDestroyed) { //ToDo:暂时屏蔽 //if (GlobalMenuManager.Instance != null) //{ // GlobalMenuManager.Instance.RemoveOpenController(ui); //} GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "RemoveOpenControllerFromILR", ui); } return(isDestroyed); }
/// <summary> /// 销毁ui,需主动调用,一般在OnRemoveFromStack中调用 /// </summary> /// <param name="isGc"></param> public void DestroySelf(bool isGc = false) { //先这样写,以后会往下走。 //DestroyController(); //return; if (this == null || gameObject == null) { return; } EB.Debug.LogUI("-----------执行【<color=#00ff00>{0}</color>】预设<color=#ff0000>清除UI</color>界面对象, 是否全屏 = {1}", MCurrentViewName, IsFullscreen()); Show(false); //ToDo:暂时屏蔽 //if (GlobalMenuManager.Instance != null) //{ // GlobalMenuManager.Instance.RemoveOpenController(this); //} GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "RemoveOpenControllerFromILR", this); if (IsFullscreen()) { transform.localPosition = mHideUIPos; if (GetComponent <BoxCollider>() != null) { GetComponent <BoxCollider>().enabled = false; } //ToDo:暂时屏蔽 //GlobalMenuManager.Instance.AddUIController(this); GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "AddUIControllerFromILR", this); } }
/// <summary> /// 批量生成二维码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmsItemQRCodeBatchGenerate_Click(object sender, EventArgs e) { int count = this.dataGridView1.SelectedRows.Count; ////选择保存路径 //string path; //FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); //if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK) // return; //path = fbd.SelectedPath; string path = GlobalUtils.OpenBrowseFolderDlg(); if (string.IsNullOrEmpty(path)) { return; } for (int i = 0; i != count; ++i) { string passportNo = dataGridView1.SelectedRows[i].Cells["PassportNo"].Value.ToString(); string name = dataGridView1.SelectedRows[i].Cells["EnglishName"].Value.ToString(); _qrCode.EncodeToPng(passportNo + "|" + name, path + "\\" + passportNo + ".jpg", QRCodeSaveSize.Size165X165); } MessageBoxEx.Show("成功保存" + count + "条记录二维码."); }
void Update() { if (IsLoadingScreenUp || Hotfix_LT.UI.LTCombatEventReceiver.Instance != null && Hotfix_LT.UI.LTCombatEventReceiver.Instance.spawnCameraing) { return; } if (Input.GetKeyDown(KeyCode.Escape)) { #if UNITY_ANDROID && !UNITY_EDITOR // Escape to None for android back button, keep touch scheme on android device if (UICamera.mainCamera != null) { UICamera mainUICamera = UICamera.mainCamera.GetComponent <UICamera>(); if (mainUICamera.useTouch) { UICamera.currentKey = KeyCode.None; UICamera.currentScheme = UICamera.ControlScheme.Touch; } } #endif if (GameFlowControlManager.IsInView()) { GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "OnCancelButtonClick"); } else if (!_exitConfirm) { _exitConfirm = true; OnExiting(ExitingResult); } } }
private bool PlayTweener(bool forward) { if (Target != null) { GlobalUtils.ChangeParent(Target.transform, transform); } var tweeners = GetComponents <UITweener>(); UITweener lastTweener = null; float lastUseTime = 0; foreach (var tweener in tweeners) { tweener.ResetToBeginning(); tweener.Play(forward); var curUseTime = tweener.duration + tweener.delay; if (curUseTime > lastUseTime) { lastTweener = tweener; lastUseTime = curUseTime; } } if (lastTweener != null && FinishCallBack != null) { lastTweener.SetOnFinished(CallBack); return(false); } return(true); }
/// <summary> /// Creates a new VcVjImage object from a GIF image located at the specified folder with the specified file name. /// </summary> /// <param name="folderName">The folder containing the GIF file (including trailing backslash, e.g. 'C:\Pictures\').</param> /// <param name="fileName">The name of the GIF file (including the extension, e.g. 'Balloons.gif').</param> public VcvjImage(string folderName, string fileName) { if (folderName.EndsWith(@"\") == false) { folderName += @"\"; } if (fileName.ToLower().EndsWith(".gif") == false) { fileName += ".gif"; } InputFolderName = folderName; InputFileName = fileName; Stream stream = GlobalUtils.ConvertImageToStream(Image.FromFile(InputFolderName + InputFileName), ImageFormat.Gif); using (MemoryStream ms = new MemoryStream()) { DataStream = new DataStream(); stream.CopyTo(ms); ms.Position = 0; DataStream.Bytes = ms.ToArray(); } DataStream = VcvjParser.ParseDataStream(DataStream.Bytes); }
protected void Page_Load(object sender, EventArgs e) { WebUserAuth.SignOut(); //移除OpenId allen 2015-07-30 GlobalUtils.ClearOpenIdFromCookie(); this.ReturnUrl = WEBRequest.GetString("ReturnUrl", "/Index.aspx"); }
public static List <T> List <T, K>(string name, object obj, List <T> defaultValue, System.Func <object, K, T> parser, System.Func <T, K, bool> match) { List <T> list = defaultValue ?? new List <T>(); Collect(name, obj, parser, delegate(T t, K k) { int index = match != null ? list.FindIndex(e => match(e, k)) : -1; if (GlobalUtils.Comparer <T>(t)) // if (EqualityComparer<T>.Default.Equals(t, default(T))) { if (index >= 0) { // remove list.RemoveAt(index); } } else { if (index >= 0) { // modify list[index] = t; } else { // add list.Add(t); } } }); return(list); }
public HourlyForecast(string description, double avgTemp, double feelTemp, double snowFall, double rainFall, int pressure, int humidity, double windSpeed, int windAngle, string icon, string country = null, string cityName = null, string cityId = null, long?sunsetTime = null, long?sunriseTime = null, double?longitude = null, double?latitude = null, string descriptionId = null, DateTime?date = null, long?dayTime = null) { PrepareDictionaries(Language.Polish, description, descriptionId, date, dayTime); PrepareDictionaries(Language.English, description, descriptionId, date, dayTime); Language = Language.Polish; Units = Units.Metric; DescriptionId = descriptionId; CityName = cityName; CityId = cityId; AvgTemp = Convert.ToInt32(avgTemp); FeelTemp = Convert.ToInt32(feelTemp); SnowFall = Math.Round(Convert.ToDouble(snowFall), 1); RainFall = Math.Round(Convert.ToDouble(rainFall), 1); WindAngle = Convert.ToInt32(windAngle - 180); Icon = icon; SunsetTime = sunsetTime != null ? (GlobalUtils.UnixTimeStampToDateTime(sunsetTime.Value) + DateTimeOffset.Now.Offset).ToString("HH:mm") : null; SunriseTime = sunriseTime != null ? (GlobalUtils.UnixTimeStampToDateTime(sunriseTime.Value) + DateTimeOffset.Now.Offset).ToString("HH:mm") : null; Longitude = longitude != null?GlobalUtils.ConvertCoordinatesFromDecToDeg(longitude.Value, true) : null; Latitude = latitude != null?GlobalUtils.ConvertCoordinatesFromDecToDeg(latitude.Value, false) : null; Pressure = Convert.ToInt32(pressure); Humidity = Convert.ToInt32(humidity); Country = country; WindSpeed = Convert.ToInt32(windSpeed * 3.6); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //判断openid为空时,重新授权 if (GlobalUtils.IsWeiXinBrowser) { Guid?userId = WebUserAuth.UserId; if (userId == null || userId == Guid.Empty) { PrintJson("-1", "对不起,您还未登录!"); return; } TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL(); userModel = bll.GetUserBasicInfoModelById(userId.Value); if (GlobalUtils.OpenId.IsEmpty()) { string strOpenId = TuanDai.WXApiWeb.Common.WeiXinApi.GetUserWXOpenId(userModel.Id); if (strOpenId.IsNotEmpty()) { GlobalUtils.WriteOpenIdToCookie(strOpenId.ToText()); } else { TuanDai.WXApiWeb.Common.WeiXinApi wxApi = new Common.WeiXinApi(); wxApi.GetOpenidAndAccessToken(this); } } } GetWXJsApiParam(); } }
protected void Page_Load(object sender, EventArgs e) { Response.Redirect("//passport.tuandai.com/2register?tdfrom=wap", false); return; if (!IsPostBack) { this.extenderkey = WEBRequest.GetString("extendkey").ToText().Trim(); this.returnUrl = WEBRequest.GetString("ReturnUrl"); string IsSaveData = WEBRequest.GetString("issave"); tdFrom = WEBRequest.GetString("tdfrom").ToText(); if (this.returnUrl.IsNotEmpty()) { string isEncry = WEBRequest.GetString("isencry"); if (isEncry == "1") { this.returnUrl = BasePage.GetDecodeBackUrl(this.returnUrl); } } if (string.IsNullOrWhiteSpace(tdFrom)) { tdFrom = WEBRequest.GetString("from").ToText(); } if (IsSaveData.ToText() == "1") { //记录帐户 openId = WEBRequest.GetString("openid"); GlobalUtils.WriteOpenIdToCookie(WEBRequest.GetString("openid")); } } }
// perform any initialization on dialogue participants static private void EnterParticipantsToDialogue() { if (null != activeDialogue.dialoguePoints) { for (int dialogue = 0; dialogue < activeDialogue.dialoguePoints.Count; ++dialogue) // go through all dialogue conversation points { if (null != activeDialogue.dialoguePoints[dialogue]) { GameObject caller = GlobalUtils.FindCharacter(activeDialogue.dialoguePoints[dialogue].caller); if (null != caller) { CharacterComponent charComp = caller.GetComponent <CharacterComponent>(); if (null != charComp) { AnimationSequence.SetAnimationEnterState(charComp); // start the dialogue enter animation if (null != charComp.TargetingComponent) { charComp.TargetingComponent.SetMovementTarget(Vector3.zero, true); // stop the character movement charComp.TargetingComponent.SetAttackTarget(null); // stop the character attacking } } //_interaction.SwitchCharacterTeam(caller.GetComponent<NPCStatsComponent>()); // stop an enemy from being targetable } } } } }
public TitlesData(MySqlConnection connection) { using (var command = connection.CreateCommand()) { command.CommandText = "SELECT * FROM `data_titles`"; command.Prepare(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var title = new TitleDataModel { Id = reader.GetUInt16("id"), Idx = reader.GetUInt16("idx"), Level = reader.GetByte("level"), UnkId1 = reader.GetUInt16("unk_id1"), UnkId2 = reader.GetUInt16("unk_id2"), Requires = reader.GetUInt32("requires"), Effect1 = new Effect(reader.GetUInt16("eff1"), reader.GetUInt16("eff1_value")), Effect2 = new Effect(reader.GetUInt16("eff2"), reader.GetUInt16("eff2_value")), Effect3 = new Effect(reader.GetUInt16("eff3"), reader.GetUInt16("eff3_value")), Desc = reader.GetString("desc"), Unk = reader.GetUInt16("unk"), Color = GlobalUtils.GetColorFromString(reader.GetString("color")) }; Objects.Add(title.Id, title); } } } }
public void CalculateRandomMove(Character character) { var x2 = character.X + GlobalUtils.Rand(120) - 60; var y2 = character.Y + GlobalUtils.Rand(100) - 50; if (x2 < 20) { x2 = 20; } if (x2 > 620) { x2 = 620; } if (y2 < 20) { y2 = 20; } if (y2 > 510) { y2 = 510; } character.TargetX = x2; character.TargetY = y2; character.CurrentAction = CharacterActionType.Move; }
IEnumerator LaunchBomb(Bomb actor, NetworkIdentity player) { NetworkIdentity _targetPlayer = GetEnemyPlayer(player.netId); NetworkIdentity targetActor = null; CellInfo cellInfo = new CellInfo { cellIndex = actor.cellIndex[0] }; //check target player if (_targetPlayer != null) { //show actor actor.visible = true; actor.RpcUpdateActor(); yield return(new WaitForSeconds(.25f)); //check target actor targetActor = GetActorInCell(_targetPlayer, GlobalUtils.GetInverseIndex(actor.cellIndex[0])); if (targetActor != null) { //reveal target actor targetActor.GetComponent <GardenActor>().visible = true; targetActor.GetComponent <Animator>().SetBool("die", true); targetActor.GetComponent <GardenActor>().RpcUpdateActor(); yield return(new WaitForSeconds(.25f)); } } //launch bomb actor.inAction = true; actor.RpcLaunchAction(cellInfo);// (cellInfo); yield return(new WaitForSeconds(2.5f)); }
public void SetMovementTargetQueue(EB.Collections.Queue <Vector3> movePosQue, System.Action onEndCallback) { _movePosQue = movePosQue; _onMoveEndActionByQue = onEndCallback; GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.AlliancesManager", "RecordTransferPointFromILRWithCallback", _movePosQue.Count - 1); SetMovementTarget(_movePosQue.Dequeue(), false, true, false, true); }
protected void Page_Load(object sender, EventArgs e) { SortedList table = Cgt_WebPost.Param(Request.InputStream); var Result = 0; if (table == null) { return; } operType = table["serviceName"].ToString(); switch (table["serviceName"].ToString()) { case "USER_AUTHORIZATION": { USER_AUTHORIZATION_Response dataJson = null; string ErrorMessage = ""; Result = UserClient.USER_AUTHORIZATION_Res(table, ref dataJson, ref ErrorMessage); break; } default: break; } this.returnUrl = WEBRequest.GetString("ReturnUrl"); this.extenderkey = WEBRequest.GetString("extendkey"); if (this.returnUrl.IsNotEmpty()) { string isEncry = WEBRequest.GetString("isencry"); if (isEncry == "1") { this.returnUrl = BasePage.GetDecodeBackUrl(this.returnUrl); } } if (!IsPostBack) { string IsSaveData = WEBRequest.GetString("issave"); this.IsShowRightBar = false; if (IsSaveData.ToText() == "1") { //记录帐户 string openId = WEBRequest.GetString("openid"); GlobalUtils.WriteOpenIdToCookie(openId); } //从微信菜单中点击“登录注册”后判断 Allen 2015-06-30 if (WEBRequest.GetString("ischecklogin") == "1") { bool isLogin = WebUserAuth.IsAuthenticated; if (isLogin) { Response.Redirect("/Member/my_account.aspx"); } else { this.returnUrl = "/Member/my_account.aspx"; } } } }
public void Generate(List <string> listWait4Replace) { if (listWait4Replace.Count > PlaceHolderNum) { MessageBoxEx.Show("数据量多余所选模板占位符数量:" + PlaceHolderNum); return; } var doc = DocComHandler.OpenDocFile(GlobalUtils.AppPath + @"\Word\Templates\" + TemplaceDocFileName); if (doc == null) { MessageBoxEx.Show("打开模板文件失败,请检查文件路径!"); return; } string dstName = GlobalUtils.OpenSaveFileDlg(DefaultName, "Word2003 Doc|*.doc"); // If the file name is not an empty string open it for saving. if (!string.IsNullOrEmpty(dstName)) { if (!DocComHandler.BatchReplaceStringByPlaceHolder(dstName, doc, listWait4Replace, true, PlaceHolderNum)) { MessageBoxEx.Show("生成报表失败,请联系技术人员!"); return; } Process.Start(dstName); } }
private void btnAddFromExcel_Click(object sender, EventArgs e) { string filename = GlobalUtils.ShowOpenFileDlg("Excel文件|*.xls;*.xlsx"); if (string.IsNullOrEmpty(filename)) { return; } FrmTimeChoose frm = new FrmTimeChoose(); if (DialogResult.Cancel == frm.ShowDialog()) { return; } var list = Common.Excel.ExcelParser.GetSteelListFromExcel(filename, frm.RetValue); if (list == null || list.Count == 0) { return; } int res = _bllSteelInfo.AddList(list); GlobalUtils.MessageBoxWithRecordNum("导入", res, list.Count); LoadDataToDgvAsyn(); }
protected void Page_Load(object sender, EventArgs e) { userId = WebUserAuth.UserId.Value; UserBLL bll = new UserBLL(); if (!this.IsPostBack) { userModel = bll.GetUserBasicInfoModelById(userId); if (userModel != null) { BankAccountNo = userModel.BankAccountNo; } UserSettingInfo UserSetting = new UserSettingBLL().GetUserSettingInfo(userId); if (UserSetting != null) { IsTenderNeedPayPassword = UserSetting.IsTenderNeedPayPassword; } if (string.IsNullOrEmpty(BankAccountNo)) { //string sql = @"SELECT BankNo FROM UserBankInfo WITH(NOLOCK) WHERE UserId = @UserId "; //var para = new Dapper.DynamicParameters(); //para.Add("@UserId", userId); //BankAccountNo = PublicConn.QuerySingle<string>(sql, ref para); var bankInfo = GlobalUtils.GetBankInfo(userId); BankAccountNo = bankInfo.BankNo; } } }
private void BtnChangeLoginUser_Click(object sender, EventArgs e) { if (MessageBoxEx.Show("是否切换用户", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { GlobalUtils.StartExe(Application.ExecutablePath); Application.ExitThread(); } }