public EventMessage Deserialize(ClientAPI.RecordedEvent source) { var json = Encoding.UTF8.GetString(source.Data); var type = Type.GetType(source.EventType); if (type == null) return null; var ev = JsonConvert.DeserializeObject(json, type); return new EventMessage { Body = ev, EventNumber = source.EventNumber }; }
/// ----------------------------------------------------------------------------- /// <summary> /// Opens a popup Calendar /// </summary> /// <param name="Field">TextBox to return the date value</param> /// <returns></returns> /// <remarks> /// </remarks> /// ----------------------------------------------------------------------------- public static string InvokePopupCal(TextBox Field) { //Define character array to trim from language strings char[] TrimChars = { ',', ' ' }; //Get culture array of month names and convert to string for //passing to the popup calendar var monthBuilder = new StringBuilder(); foreach (string Month in DateTimeFormatInfo.CurrentInfo.MonthNames) { monthBuilder.AppendFormat("{0},", Month); } var MonthNameString = monthBuilder.ToString().TrimEnd(TrimChars); //Get culture array of day names and convert to string for //passing to the popup calendar var dayBuilder = new StringBuilder(); foreach (string Day in DateTimeFormatInfo.CurrentInfo.AbbreviatedDayNames) { dayBuilder.AppendFormat("{0},", Day); } var DayNameString = dayBuilder.ToString().TrimEnd(TrimChars); //Get the short date pattern for the culture string FormatString = DateTimeFormatInfo.CurrentInfo.ShortDatePattern; if (!Field.Page.ClientScript.IsClientScriptIncludeRegistered("PopupCalendar.js")) { ScriptManager.RegisterClientScriptInclude(Field.Page, Field.Page.GetType(), "PopupCalendar.js", ClientAPI.ScriptPath + "PopupCalendar.js"); } string strToday = ClientAPI.GetSafeJSString(Localization.GetString("Today")); string strClose = ClientAPI.GetSafeJSString(Localization.GetString("Close")); string strCalendar = ClientAPI.GetSafeJSString(Localization.GetString("Calendar")); return(string.Concat("javascript:popupCal('Cal','", Field.ClientID, "','", FormatString, "','", MonthNameString, "','", DayNameString, "','", strToday, "','", strClose, "','", strCalendar, "',", (int)DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek, ");")); }
public void RegisterAjaxScript(Page page) { var portalSettings = TestablePortalController.Instance.GetCurrentPortalSettings(); if (portalSettings == null) { return; } var path = portalSettings.PortalAlias.HTTPAlias; int index = path.IndexOf('/'); if (index > 0) { path = path.Substring(index); } else { path = "/"; } path = path.EndsWith("/") ? path : path + "/"; ClientAPI.RegisterClientReference(page, ClientAPI.ClientNamespaceReferences.dnn); ClientAPI.RegisterClientVariable(page, "sf_siteRoot", path, /*overwrite*/ true); ClientAPI.RegisterClientVariable(page, "sf_tabId", PortalSettings.Current.ActiveTab.TabID.ToString(CultureInfo.InvariantCulture), /*overwrite*/ true); string scriptPath; if (HttpContextSource.Current.IsDebuggingEnabled) { scriptPath = "~/js/Debug/dnn.servicesframework.js"; } else { scriptPath = "~/js/dnn.servicesframework.js"; } ClientResourceManager.RegisterScript(page, scriptPath); }
private static async void Loop(List <ClientConnect.PathDA> lol, string str) { var status = false; status = !status; ClientAPI.SetValue("localhost:102", status, null, 0, lol[0], false, false, false, null, OrCat.PROCESS); //Direct_WithNormalSecurity ClientAPI.SetValue("localhost:102", status, null, 0, lol[1], false, false, false, null, OrCat.PROCESS); //Sbo_WithNormalSecurity ClientAPI.SetValue("localhost:102", status, null, 0, lol[2], false, false, false, null, OrCat.PROCESS); //Direct_EnhanceadSecurity Thread.Sleep(100); var test1 = await ClientAPI.GetValue(str, lol[0]); Assert.AreEqual(status, test1); dynamic test2 = await ClientAPI.GetValue(str, lol[1]); Assert.AreEqual(status, test2); dynamic test3 = await ClientAPI.GetValue(str, lol[2]); Assert.AreEqual(status, test3); status = !status; ClientAPI.SetValue("localhost:102", status, null, 0, lol[0], false, false, false, null, OrCat.PROCESS); //Direct_WithNormalSecurity ClientAPI.SetValue("localhost:102", status, null, 0, lol[1], false, false, false, null, OrCat.PROCESS); //Sbo_WithNormalSecurity ClientAPI.SetValue("localhost:102", status, null, 0, lol[2], false, false, false, null, OrCat.PROCESS); //Direct_EnhanceadSecurity Thread.Sleep(100); test1 = await ClientAPI.GetValue(str, lol[0]); Assert.AreEqual(!status, test1); test2 = await ClientAPI.GetValue(str, lol[1]); Assert.AreEqual(!status, test2); test3 = await ClientAPI.GetValue(str, lol[2]); Assert.AreEqual(!status, test3); Console.WriteLine("end"); Thread.Sleep(0); }
private void FindGames() { OpenPopup <PopupLoading>("PopupLoading", popup => { popup.text.text = "Finding games..."; }); #if ENABLE_MASTER_SERVER_KIT var includeProperties = new List <MasterServerKit.Property>(); var excludeProperties = new List <MasterServerKit.Property>(); ClientAPI.FindGameRooms(includeProperties, excludeProperties, matches => { ClosePopup(); foreach (Transform child in gameListContent.transform) { Destroy(child.gameObject); } numGamesText.text = matches.Length.ToString(); foreach (var match in matches) { if (match.numPlayers > 0) { var go = Instantiate(gameListItemPrefab) as GameObject; go.transform.SetParent(gameListContent.transform, false); var gameListItem = go.GetComponent <GameListItem>(); gameListItem.gameNameText.text = match.name; gameListItem.lockIcon.gameObject.SetActive(match.isPrivate); gameListItem.scene = this; gameListItem.matchInfo = match; } } }); #else GameNetworkManager.Instance.matchMaker.ListMatches(0, 10, string.Empty, false, 0, 0, OnMatchList); #endif }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if (!Page.IsPostBack) { ClientAPI.RegisterKeyCapture(txtSearch, cmdSearch, 13); //Load the Search Combo ddlSearchType.Items.Add(AddSearchItem("Username")); ddlSearchType.Items.Add(AddSearchItem("Email")); ddlSearchType.Items.Add(AddSearchItem("DisplayName")); var controller = new ListController(); ListEntryInfo imageDataType = controller.GetListEntryInfo("DataType", "Image"); ProfilePropertyDefinitionCollection profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalId, false, false); foreach (ProfilePropertyDefinition definition in profileProperties) { if (imageDataType != null && definition.DataType != imageDataType.EntryID) { ddlSearchType.Items.Add(AddSearchItem(definition.PropertyName)); } } //Sent controls to current Filter if ((!String.IsNullOrEmpty(Filter) && Filter.ToUpper() != "NONE") && !String.IsNullOrEmpty(FilterProperty)) { txtSearch.Text = Filter; ddlSearchType.SelectedValue = FilterProperty; } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Binds a data item to the datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// Adds a warning message before leaving the page to edit in full editor so the user can save changes /// Customizes edit textbox and default value /// </remarks> /// <history> /// [vmasanas] 20/10/2004 Created /// [vmasanas] 25/03/2006 Modified to support new host resources and incremental saving /// </history> protected void dgEditor_ItemDataBound(object sender, DataGridItemEventArgs e) { try { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { HyperLink c; c = (HyperLink)e.Item.FindControl("lnkEdit"); if (c != null) { ClientAPI.AddButtonConfirm(c, Localization.GetString("SaveWarning", this.LocalResourceFile)); } Pair p = (Pair)(((DictionaryEntry)e.Item.DataItem).Value); TextBox t; t = (TextBox)e.Item.FindControl("txtValue"); if (p.First.ToString() == p.Second.ToString() && chkHighlight.Checked && p.Second.ToString() != "") { t.CssClass = "Pending"; } if (p.First.ToString().Length > 30) { t.Height = new Unit("100"); } t.Text = Server.HtmlDecode(p.First.ToString()); Label l; l = (Label)e.Item.FindControl("lblDefault"); l.Text = Server.HtmlDecode(p.Second.ToString()); } } catch (Exception exc) //Module failed to load { Exceptions.Exceptions.ProcessModuleLoadException(this, exc); } }
public async Task <IHttpActionResult> InvokeDomainEndPoint(APICallSignature callSig) { try { ClientAPI clientApi = ResolveUri(callSig); object obj = ResolveObject(callSig); string errorMsg = ""; if (obj == null) { errorMsg = "Object is null"; var resp = new HttpResponseMessage(HttpStatusCode.NotFound); resp.Content = new StringContent(errorMsg); resp.ReasonPhrase = "Object not found."; throw new HttpResponseException(resp); } if (string.IsNullOrEmpty(clientApi.URL)) { errorMsg = "URL invalid"; var resp = new HttpResponseMessage(HttpStatusCode.NotFound); resp.Content = new StringContent(errorMsg); resp.ReasonPhrase = "No API."; throw new HttpResponseException(resp); } await InvokeClientAPI(obj, clientApi.URL, clientApi.SboTransactionType); return(Ok("Success")); } catch (HttpResponseException ex) { throw new HttpResponseException(HttpStatusCode.BadRequest); } }
private void RegisterInitScripts() { RegisterLocalResources(); ClientAPI.RegisterClientVariable(Page, "cem_loginurl", Globals.LoginURL(HttpContext.Current.Request.RawUrl, false), true); var panes = string.Join(",", PortalSettings.ActiveTab.Panes.Cast <string>()); var panesClientIds = GetPanesClientIds(GetPaneClientIdCollection()); const string scriptFormat = @"dnn.ContentEditorManager.init({{type: 'moduleManager', panes: '{0}', panesClientIds: '{2}', supportAjax: {1}}});"; var script = string.Format(scriptFormat, panes, SupportAjax ? "true" : "false", panesClientIds); if (ScriptManager.GetCurrent(Page) != null) { // respect MS AJAX ScriptManager.RegisterStartupScript(Page, GetType(), "ContentEditorManager", script, true); } else { Page.ClientScript.RegisterStartupScript(GetType(), "ContentEditorManager", script, true); } }
private static async Task <bool> DownloadFromMirror(Archive archive, AbsolutePath destination) { try { var url = await ClientAPI.GetMirrorUrl(archive.Hash); if (url == null) { return(false); } var newArchive = new Archive( new WabbajackCDNDownloader.State(url)) { Hash = archive.Hash, Size = archive.Size, Name = archive.Name }; return(await Download(newArchive, destination)); } catch (Exception) { return(false); } }
/// ----------------------------------------------------------------------------- /// <summary> /// When it is determined that the client supports a rich interactivity the grdProfileProperties_ItemCreated /// event is responsible for disabling all the unneeded AutoPostBacks, along with assiging the appropriate /// client-side script for each event handler /// </summary> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 03/12/2006 created /// </history> /// ----------------------------------------------------------------------------- private void grdProfileProperties_ItemCreated(object sender, DataGridItemEventArgs e) { if (SupportsRichClient()) { switch (e.Item.ItemType) { case ListItemType.Header: //we combined the header label and checkbox in same place, so it is control 1 instead of 0 ((WebControl)e.Item.Cells[COLUMN_REQUIRED].Controls[1]).Attributes.Add("onclick", "dnn.util.checkallChecked(this," + COLUMN_REQUIRED + ");"); ((CheckBox)e.Item.Cells[COLUMN_REQUIRED].Controls[1]).AutoPostBack = false; ((WebControl)e.Item.Cells[COLUMN_VISIBLE].Controls[1]).Attributes.Add("onclick", "dnn.util.checkallChecked(this," + COLUMN_VISIBLE + ");"); ((CheckBox)e.Item.Cells[COLUMN_VISIBLE].Controls[1]).AutoPostBack = false; break; case ListItemType.AlternatingItem: case ListItemType.Item: ((CheckBox)e.Item.Cells[COLUMN_REQUIRED].Controls[0]).AutoPostBack = false; ((CheckBox)e.Item.Cells[COLUMN_VISIBLE].Controls[0]).AutoPostBack = false; ClientAPI.EnableClientSideReorder(e.Item.Cells[COLUMN_MOVE_DOWN].Controls[0], Page, false, grdProfileProperties.ClientID); ClientAPI.EnableClientSideReorder(e.Item.Cells[COLUMN_MOVE_UP].Controls[0], Page, true, grdProfileProperties.ClientID); break; } } }
// Use this for initialization void Start() { // Init ManagerScript blockManager = blockManagerObj.GetComponent <BlockManager>(); NetManagerObj = GameObject.Find("NetworkManager"); NetManager = NetManagerObj.GetComponent <ClientAPI>(); PlayerDataManagerObj = GameObject.Find("PlayerDataManager"); PlayerDataManager = PlayerDataManagerObj.GetComponent <PlayerDataManager>(); roomList = new List <RoomData>(); updateBlockInfo = new Stack <BlockInfo>(); emptyRoomNum = new List <int>(); roomBaseSet = new HashSet <BasePos>(); addObjList = new List <GameObject>(); roomNumDic = new Dictionary <Vector3, int>(); for (int i = 0; i < MAX_ROOM_NUM; ++i) { emptyRoomNum.Add(i); } blockContainer = new GameObject(); blockContainer.transform.position = new Vector3(0.0f, 0.0f, 0.0f); }
void grdFields_ItemCreated(object sender, DataGridItemEventArgs e) { try { var cmdDeleteUserDefinedField = e.Item.FindControl("cmdDeleteUserDefinedField"); if (cmdDeleteUserDefinedField != null) { ClientAPI.AddButtonConfirm((WebControl)cmdDeleteUserDefinedField, LocalizeString("DeleteField")); } if (e.Item.ItemType == ListItemType.Header) { e.Item.Cells[1].Attributes.Add("scope", "col"); e.Item.Cells[2].Attributes.Add("scope", "col"); e.Item.Cells[3].Attributes.Add("scope", "col"); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public bool RegisterToolBar(Control objAssociatedControl, string strShowEventName, string strHideEventName, string strToolBarActionHandler, string ToolBarScriptPath) { if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML)) { DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(this.Page, DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences.dnn_dom); if (!ClientAPI.IsClientScriptBlockRegistered(this.Page, "dnn.controls.dnntoolbarstub.js")) { ClientAPI.RegisterClientScriptBlock(this.Page, "dnn.controls.dnntoolbarstub.js", "<script src=\"" + ToolBarScriptPath + "dnn.controls.dnntoolbarstub.js\"></script>"); } string strJS = string.Format("__dnn_toolbarHandler('{0}','{1}','{2}',{3},'{4}','{5}')", this.UniqueID, objAssociatedControl.ClientID, this.NamingContainer.UniqueID, strToolBarActionHandler, strShowEventName, strHideEventName); if (objAssociatedControl is WebControl) { ((WebControl)objAssociatedControl).Attributes.Add(strShowEventName, strJS); } else if (objAssociatedControl is HtmlControl) { ((HtmlControl)objAssociatedControl).Attributes.Add(strShowEventName, strJS); } return(true); } return(false); }
public void PlayLieDown() { // First check if the player is already lying down bool playerLyingDown = false; if (ClientAPI.GetPlayerObject().PropertyExists("currentAnim")) { if ((string)ClientAPI.GetPlayerObject().GetProperty("currentAnim") == "lie") { playerLyingDown = true; } } if (playerLyingDown) { // Player is lying down so reset anim back to normal NetworkAPI.SendTargetedCommand(ClientAPI.GetPlayerOid(), "/setStringProperty currentAnim null"); } else { // Player is not lying down so set anim to lie NetworkAPI.SendTargetedCommand(ClientAPI.GetPlayerOid(), "/setStringProperty currentAnim lie"); } }
void Update() { if (station != null) { if (Vector3.Distance(ClientAPI.GetPlayerObject().Position, station.transform.position) > 5) { ClearGrid(); station.SendMessage("CloseStation"); station = null; string[] args = new string[1]; AtavismEventSystem.DispatchEvent("CLOSE_CRAFTING_STATION", args); } } if (currentResourceNode > 0 && resourceNodes.ContainsKey(currentResourceNode)) { if (Vector3.Distance(ClientAPI.GetPlayerObject().Position, resourceNodes[currentResourceNode].gameObject.transform.position) > 5) { currentResourceNode = -1; string[] args = new string[1]; AtavismEventSystem.DispatchEvent("CLOSE_RESOURCE_LOOT_WINDOW", args); } } }
/// <summary> Creates a new server with the provided name and region. </summary> public async Task <Server> CreateServer(string name, Region region, ImageType iconType = ImageType.None, Stream icon = null) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (region == null) { throw new ArgumentNullException(nameof(region)); } var request = new CreateGuildRequest() { Name = name, Region = region.Id, IconBase64 = icon.Base64(iconType, null) }; var response = await ClientAPI.Send(request).ConfigureAwait(false); var server = AddServer(response.Id); server.Update(response); return(server); }
protected void rptTaskListOnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { var lnkEdit = e.Item.FindControl("lnkEdit") as LinkButton; var lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton; var pnlAdminControls = e.Item.FindControl("pnlAdmin") as Panel; var curTask = (Task)e.Item.DataItem; if (IsEditable && lnkDelete != null && lnkEdit != null && pnlAdminControls != null) { pnlAdminControls.Visible = true; lnkDelete.CommandArgument = lnkEdit.CommandArgument = curTask.TaskId.ToString(); lnkDelete.Enabled = lnkDelete.Visible = lnkEdit.Enabled = lnkEdit.Visible = true; ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile)); } else { pnlAdminControls.Visible = false; } } }
public void SendPlaceClaimObject(int buildObjectID, AtavismInventoryItem item, Transform transform, int parent) { Dictionary <string, object> props = new Dictionary <string, object>(); props.Add("claim", activeClaim.id); props.Add("loc", transform.position); props.Add("orient", transform.rotation); props.Add("parent", parent); if (item != null) { props.Add("buildObjectTemplateID", buildObjectID); props.Add("itemID", item.templateId); props.Add("itemOID", item.ItemId); } else { props.Add("buildObjectTemplateID", buildObjectID); props.Add("itemID", -1); props.Add("itemOID", null); } NetworkAPI.SendExtensionMessage(ClientAPI.GetPlayerOid(), false, "voxel.PLACE_CLAIM_OBJECT", props); }
public List <AtavismEffect> GetTargetEffects() { List <AtavismEffect> targetEffects = new List <AtavismEffect>(); LinkedList <object> effects_prop = (LinkedList <object>)ClientAPI.GetTargetObject().GetProperty("effects"); AtavismLogger.LogDebugMessage("Got target effects property change: " + effects_prop); // int pos = 0; foreach (string effectsProp in effects_prop) { string[] effectData = effectsProp.Split(','); int effectID = int.Parse(effectData[0]); //long endTime = long.Parse(effectData[2]); //long serverTime = ClientAPI.ScriptObject.GetComponent<TimeManager>().ServerTime; //long timeTillEnd = endTime - serverTime; long timeUntilEnd = long.Parse(effectData[3]); bool active = bool.Parse(effectData[4]); long duration = long.Parse(effectData[5]); AtavismLogger.LogInfoMessage("Got effect " + effectID + " active? " + active); //if (timeTillEnd < duration) // duration = timeTillEnd; float secondsLeft = (float)timeUntilEnd / 1000f; if (!effects.ContainsKey(effectID)) { AtavismLogger.LogWarning("Effect " + effectID + " does not exist"); continue; } AtavismEffect effect = effects[effectID].Clone(tempCombatDataStorage); effect.Active = active; effect.Expiration = Time.time + secondsLeft; effect.Length = duration / 1000f; targetEffects.Add(effect); } return(targetEffects); }
void SendGridUpdated() { // Send message to server to work out if we have a valid recipe Dictionary <string, object> props = new Dictionary <string, object>(); LinkedList <object> itemIds = new LinkedList <object>(); LinkedList <object> itemCounts = new LinkedList <object>(); for (int i = 0; i < gridItems.Count; i++) { if (gridItems[i].item != null) { itemIds.AddLast(gridItems[i].item.templateId); } else { itemIds.AddLast(-1); } itemCounts.AddLast(gridItems[i].count); } props.Add("gridSize", gridSize); props.Add("componentIDs", itemIds); props.Add("componentCounts", itemCounts); props.Add("stationType", stationType.ToString()); if (recipeItem != null) { props.Add("recipeItemID", recipeItem.templateId); } else { props.Add("recipeItemID", -1); } NetworkAPI.SendExtensionMessage(ClientAPI.GetPlayerOid(), false, "crafting.GRID_UPDATED", props); //string[] args = new string[1]; //AtavismEventSystem.DispatchEvent("INVENTORY_UPDATE", args); }
protected override void OnInit(EventArgs e) { // Moved from BindSettings to handle issues with the RTE teSubmissionSuccess.Text = ModuleContext.Settings[SettingName.SubmissionText].AsString(Localization.GetString("SubmissionSuccess", LocalResourceFile)); teTrackingMessage.Text = ModuleContext.Settings[SettingName.TrackingMessage].AsString(); cmdCancel.Click += cmdCancel_Click; cmdEditEmail.Click += cmdEditEmail_Click; cmdEditXSL.Click += cmdEditXSL_Click; cmdGenerateEmail.Click += cmdGenerateEmail_Click; cmdGenerateXSL.Click += cmdGenerateXSL_Click; cmdUpdate.Click += cmdUpdate_Click; chkShowSearchTextBox.CheckedChanged += chkShowSearchTextBox_CheckedChanged; Load += Page_Load; Fields.LocalizeString = LocalizeString; Fields.LocalResourceFile = LocalResourceFile; Fields.ModuleContext = ModuleContext; jQuery.RequestDnnPluginsRegistration(); ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn); }
/// ----------------------------------------------------------------------------- /// <summary> /// Opens a popup Calendar /// </summary> /// <param name="Field">TextBox to return the date value</param> /// <returns></returns> /// <remarks> /// </remarks> /// <history> /// [VMasanas] 12/09/2004 Added localized parameter strings: today, close, calendar /// Use AbbreviatedDayName property instead of first 3 chars of day name /// [VMasanas] 14/10/2004 Added support for First Day Of Week /// [VMasanas] 14/11/2004 Register client script to work with FriendlyURLs /// </history> /// ----------------------------------------------------------------------------- public static string InvokePopupCal(TextBox Field) { //Define character array to trim from language strings char[] TrimChars = { ',', ' ' }; //Get culture array of month names and convert to string for //passing to the popup calendar string MonthNameString = ""; foreach (string Month in DateTimeFormatInfo.CurrentInfo.MonthNames) { MonthNameString += Month + ","; } MonthNameString = MonthNameString.TrimEnd(TrimChars); //Get culture array of day names and convert to string for //passing to the popup calendar string DayNameString = ""; foreach (string Day in DateTimeFormatInfo.CurrentInfo.AbbreviatedDayNames) { DayNameString += Day + ","; } DayNameString = DayNameString.TrimEnd(TrimChars); //Get the short date pattern for the culture string FormatString = DateTimeFormatInfo.CurrentInfo.ShortDatePattern; if (!Field.Page.ClientScript.IsClientScriptIncludeRegistered("PopupCalendar.js")) { ScriptManager.RegisterClientScriptInclude(Field.Page, Field.Page.GetType(), "PopupCalendar.js", ClientAPI.ScriptPath + "PopupCalendar.js"); } string strToday = ClientAPI.GetSafeJSString(Localization.GetString("Today")); string strClose = ClientAPI.GetSafeJSString(Localization.GetString("Close")); string strCalendar = ClientAPI.GetSafeJSString(Localization.GetString("Calendar")); return("javascript:popupCal('Cal','" + Field.ClientID + "','" + FormatString + "','" + MonthNameString + "','" + DayNameString + "','" + strToday + "','" + strClose + "','" + strCalendar + "'," + (int)DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek + ");"); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { imgSearch.Click += OnSearchClick; AwardMessaging(); if (Page.IsPostBack) { return; } BindNavigation(); if (Keyword.Length > 0) { txtSearch.Text = Keyword; } else { txtSearch.Attributes.Add("defaultvalue", Localization.GetString("overlaySearch", MyResourceFile)); } Framework.AJAX.RegisterPostBackControl(imgSearch); ClientAPI.RegisterKeyCapture(txtSearch, imgSearch, 13); }
public void HandleCombatEvent(Dictionary <string, object> props) { string eventType = (string)props["event"]; OID caster = (OID)props["caster"]; OID target = (OID)props["target"]; int abilityID = (int)props["abilityID"]; int effectID = (int)props["effectID"]; string value1 = "" + (int)props["value1"]; string value2 = "" + (int)props["value2"]; string value3 = (string)props["value3"]; string value4 = (string)props["value4"]; // Debug.LogWarning("Got Combat Event " + eventType); // Debug.LogError("HandleCombatEvent " + caster + " | " + target + " | " + abilityID + " | " + effectID + " | " + value1 + " | " + value2+" | "+ eventType); //Automatical select attacer try { if (target.ToLong() == ClientAPI.GetPlayerOid() && target != caster && (ClientAPI.GetTargetObject() == null || (ClientAPI.GetTargetObject() != null && ClientAPI.GetTargetObject().PropertyExists("health") && (int)ClientAPI.GetTargetObject().GetProperty("health") == 0))) { ClientAPI.SetTarget(caster.ToLong()); } } catch (System.Exception e) { Debug.LogError("Exception e=" + e); } // ClientAPI.Write("Got Combat Event: " + eventType); // int messageType = 2; if (eventType == "CombatPhysicalDamage") { // messageType = 1; } else if (eventType == "CombatMagicalDamage") { } else if (eventType == "CombatPhysicalCritical") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Critic"); // messageType = 1; } else if (eventType == "CombatMagicalCritical") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Critic"); // messageType = 1; } else if (eventType == "CombatMissed") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Evaded"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("MissedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Missed"); } #else value1 = "Missed"; #endif } else if (eventType == "CombatDodged") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Dodged"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("DodgedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Dodged"); } #else value1 = "Dodged"; #endif } else if (eventType == "CombatBlocked") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Blocked"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("BlockedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Blocked"); } #else value1 = "Blocked"; #endif } else if (eventType == "CombatParried") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Parried"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("ParriedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Parried"); } #else value1 = "Parried"; #endif } else if (eventType == "CombatEvaded") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Evaded"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("EvadedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Evaded"); } #else value1 = "Evaded"; #endif } else if (eventType == "CombatImmune") { #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("ImmuneSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Immune"); } #else value1 = "Immune"; #endif } else if (eventType == "CombatBuffGained" || eventType == "CombatDebuffGained") { AtavismEffect e = Abilities.Instance.GetEffect(effectID); if (e != null) { #if AT_I2LOC_PRESET value1 = I2.Loc.LocalizationManager.GetTranslation("Ability/" + e.name); #else value1 = e.name; #endif } else { value1 = ""; } } else if (eventType == "CombatBuffLost" || eventType == "CombatDebuffLost") { AtavismEffect e = Abilities.Instance.GetEffect(effectID); if (e != null) { #if AT_I2LOC_PRESET value1 = I2.Loc.LocalizationManager.GetTranslation("Effects/" + e.name); #else value1 = e.name; #endif } else { value1 = ""; } } else if (eventType == "CastingStarted") { if (int.Parse(value1) > 0) { string[] csArgs = new string[2]; csArgs[0] = value1; csArgs[1] = caster.ToString(); AtavismEventSystem.DispatchEvent("CASTING_STARTED", csArgs); } return; } else if (eventType == "CastingCancelled") { // Debug.LogError("CastingCancelled 1"); string[] ccArgs = new string[2]; ccArgs[0] = abilityID.ToString(); ccArgs[1] = caster.ToString(); AtavismEventSystem.DispatchEvent("CASTING_CANCELLED", ccArgs); // Debug.LogError("CastingCancelled 2"); return; } // dispatch a ui event to tell the rest of the system try { string[] args = new string[9]; args[0] = eventType; args[1] = caster.ToString(); args[2] = target.ToString(); args[3] = value1; args[4] = value2; args[5] = abilityID.ToString(); args[6] = effectID.ToString(); args[7] = value3; args[8] = value4; AtavismEventSystem.DispatchEvent("COMBAT_EVENT", args); } catch (System.Exception e) { Debug.LogError("COMBAT_EVENT Exception:" + e); } //ClientAPI.GetObjectNode(target.ToLong()).GameObject.GetComponent<MobController3D>().GotDamageMessage(messageType, value1); }
protected string GetButtonConfirmHeader(string toolName) { return(ClientAPI.GetSafeJSString(Localization.GetString("Tool." + toolName + ".ConfirmHeader", this.LocalResourceFile))); }
protected string GetPublishActionText() { return(TabPublishingController.Instance.IsTabPublished(TabController.CurrentPage.TabID, this.PortalSettings.PortalId) ? ClientAPI.GetSafeJSString(this.GetString("Tool.UnpublishPage.Text")) : ClientAPI.GetSafeJSString(this.GetString("Tool.PublishPage.Text"))); }
public virtual void HandleGeneralEvent(Dictionary <string, object> props) { string eventType = (string)props["event"]; int val = (int)props["val"]; string data = (string)props["data"]; string[] args = new string[1]; string errorMessage = ""; //string errorMessage = eventType; if (eventType == "ReputationChanged") { #if AT_I2LOC_PRESET errorMessage = I2.Loc.LocalizationManager.GetTranslation("Reputation for faction") + " " + (string)props["name"] + " " + I2.Loc.LocalizationManager.GetTranslation("increased by") + ": " + data; #else errorMessage = "Reputation for faction " + (string)props["name"] + " increased by: " + data; #endif } else if (eventType == "DuelCountdown") { errorMessage = "" + val; } else if (eventType == "DuelStart") { #if AT_I2LOC_PRESET errorMessage = I2.Loc.LocalizationManager.GetTranslation("Fight!"); #else errorMessage = "Fight!"; #endif args[0] = "120";//Dual Time AtavismEventSystem.DispatchEvent("TimerStart", args); } else if (eventType == "DuelVictory") { string[] results = data.Split(','); string winner = results[0]; string loser = results[1]; string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = winner + " " + I2.Loc.LocalizationManager.GetTranslation("has defeated") + " " + loser + " " + I2.Loc.LocalizationManager.GetTranslation("in a duel"); #else cArgs[0] = winner + " has defeated " + loser + " in a duel"; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); if (winner == ClientAPI.GetPlayerObject().Name) { AtavismEventSystem.DispatchEvent("TimerStop", args); #if AT_I2LOC_PRESET errorMessage = I2.Loc.LocalizationManager.GetTranslation("Victory!"); #else errorMessage = "Victory!"; #endif } else { return; } } else if (eventType == "DuelDefeat") { AtavismEventSystem.DispatchEvent("TimerStop", args); if (data == ClientAPI.GetPlayerObject().Name) { #if AT_I2LOC_PRESET errorMessage = I2.Loc.LocalizationManager.GetTranslation("Defeat!"); #else errorMessage = "Defeat!"; #endif } else { return; } } else if (eventType == "DuelOutOfBounds") { #if AT_I2LOC_PRESET errorMessage = I2.Loc.LocalizationManager.GetTranslation("You have left the Duel Area, if you do not return you will forfeit the duel"); #else errorMessage = "You have left the Duel Area, if you do not return you will forfeit the duel"; #endif } else if (eventType == "DuelNotOutOfBounds") { #if AT_I2LOC_PRESET errorMessage = I2.Loc.LocalizationManager.GetTranslation("You have returned to the Duel Area"); #else errorMessage = "You have returned to the Duel Area"; #endif } else if (eventType == "GuildMemberJoined") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = data + " " + I2.Loc.LocalizationManager.GetTranslation("has joined the Guild."); #else cArgs[0] = data + " has joined the Guild."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); } else if (eventType == "GuildMemberLeft") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = data + " " + I2.Loc.LocalizationManager.GetTranslation("has left the Guild."); #else cArgs[0] = data + " has left the Guild."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); } else if (eventType == "GuildRankNoDeleteIsMember") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = I2.Loc.LocalizationManager.GetTranslation("Can't delete rank because rank is assign to Guild member."); #else cArgs[0] = "Can't delete rank because rank is assign to Guild member."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("ERROR_MESSAGE", cArgs); } else if (eventType == "GuildMasterNoLeave") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = I2.Loc.LocalizationManager.GetTranslation("Guild Master can't leave Guild."); #else cArgs[0] = "Guild Master can't leave Guild."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("ERROR_MESSAGE", cArgs); } else if (eventType == "SocketingFail") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = I2.Loc.LocalizationManager.GetTranslation("Socketing Failed"); #else cArgs[0] = "Socketing Failed."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); } else if (eventType == "SocketingSuccess") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = I2.Loc.LocalizationManager.GetTranslation("Socketing Succeeded"); #else cArgs[0] = "Socketing Succeeded"; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); } else if (eventType == "EnchantingFail") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = I2.Loc.LocalizationManager.GetTranslation("Enchanting Failed"); #else cArgs[0] = "Enchanting Failed."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); } else if (eventType == "EnchantingSuccess") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = I2.Loc.LocalizationManager.GetTranslation("Enchanting Succeeded"); #else cArgs[0] = "Enchanting Succeeded."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); } else if (eventType == "RepairSuccessful") { string[] cArgs = new string[3]; #if AT_I2LOC_PRESET cArgs[0] = I2.Loc.LocalizationManager.GetTranslation("Repair Succeeded"); #else cArgs[0] = "Repair Succeeded."; #endif cArgs[1] = "System"; cArgs[2] = ""; AtavismEventSystem.DispatchEvent("CHAT_MSG_SYSTEM", cArgs); } else { Debug.LogWarning("general_event " + eventType + " is not found"); } // dispatch a ui event to tell the rest of the system args[0] = errorMessage; AtavismEventSystem.DispatchEvent("ANNOUNCEMENT", args); }
public void GetAllVips() { Dictionary <string, object> props = new Dictionary <string, object>(); NetworkAPI.SendExtensionMessage(ClientAPI.GetPlayerOid(), false, "ao.GET_ALL_VIP", props); }
public void RegisterDNNVariableControl() { ClientAPI.RegisterDNNVariableControl(this); }
protected void ParentOnLoad(object Sender, EventArgs e) { ClientAPI.RegisterDNNVariableControl(this); LoadPostedXML(); }
public VNodeBuilder RunProjections(ClientAPI.Embedded.ProjectionsMode projectionsMode, int numberOfThreads = Opts.ProjectionThreadsDefault) { return RunProjections((ProjectionType)projectionsMode, numberOfThreads); }
void Start() { if (instance == null) { instance = this; } else { GameObject.DestroyImmediate(gameObject); return; } AtavismClient client = gameObject.AddComponent<AtavismClient>(); client.Initalise(scriptObject, defaultObject, WorldId, webPlayer, logLevel, playerLayer, playerTag); client.DefaultMasterServer = masterServer; client.MasterServer = masterServer; client.DefaultWorldId = WorldId; if (resourceManager != null) { client.resourceManager = resourceManager; } ScriptObject.BroadcastMessage("ClientReady"); }