public static void GeneratePortal() { PortalType type = PortalType.Undead; Portal temp; bool validtype = false; int count = 0; while (!validtype) { int random = Utility.Random(0, 6); type = (PortalType)random; temp = PortalList.Values.FirstOrDefault(x => x.Status == PortalStatus.Running && x.PortalType == type); if (temp == null) { validtype = true; } count++; if (count >= 100) { Console.WriteLine("Failed to create valid portal!"); return; } } var portal = new Portal(type, DateTime.UtcNow); PortalList.Add(portal.UID, portal); }
public void TriggerPortalEntry(PortalType type) { if (redPortal == null || bluePortal == null) { return; } PortalController exit; GameObject player = trans.parent.gameObject; ArrowKeyMovement playerMovement = player.GetComponent <ArrowKeyMovement>(); if (playerMovement.portalExit) { return; } if (type == PortalType.Red) { AudioSource.PlayClipAtPoint(portalEnterRed, Camera.main.transform.position, 0.35f); exit = bluePortal; } else { AudioSource.PlayClipAtPoint(portalEnterBlue, Camera.main.transform.position, 0.35f); exit = redPortal; } player.transform.position = exit.transform.position; playerMovement.portalExit = true; playerMovement.SetDirection(GameController.getReverseDirection(exit.portalDir)); }
public IMaplePortal MakePortal(PortalType type, IMapleData portal) { var ret = new MapleGenericPortal(type); LoadPortal(ret, portal); return(ret); }
public Portal(Vector2D position, short destinationId, PortalType portalType, int id) { Position = position; DestinationId = destinationId; PortalType = portalType; Id = id; }
public LimitedAccessAttribute(PortalType requiredPortalType) : base(typeof(LimitedAccessAttributeImpl)) { Arguments = new object[] { requiredPortalType }; }
public string ToHtml(PortalType type) { if (type == PortalType.H24) { return(H24.ArticleHtml.Replace("@title@", Title).Replace("@lead@", Lead).Replace("@author@", Author).Replace("@time@", Time).Replace("@content@", Content).Replace("@link@", Link)); } else if (type == PortalType.Index) { return(Index.ArticleHtml.Replace("@title@", Title).Replace("@lead@", Lead).Replace("@author@", Author).Replace("@time@", Time).Replace("@content@", Content).Replace("@link@", Link)); } else if (type == PortalType.Jutarnji) { return(Jutarnji.ArticleHtml.Replace("@title@", Title).Replace("@lead@", Lead).Replace("@author@", Author).Replace("@time@", Time).Replace("@content@", Content).Replace("@link@", Link)); } else if (type == PortalType.Vecernji) { return(Vecernji.ArticleHtml.Replace("@title@", Title).Replace("@lead@", Lead).Replace("@author@", Author).Replace("@time@", Time).Replace("@content@", Content).Replace("@link@", Link)); } else if (type == PortalType.Net) { return(Net.ArticleHtml.Replace("@title@", Title).Replace("@lead@", Lead).Replace("@author@", Author).Replace("@time@", Time).Replace("@content@", Content).Replace("@link@", Link)); } else { return(null); } }
public SecurityManager(ISecurityServiceAgent securityService, IUserManagementServiceAgent userManagementService, ILoggingService loggingService, PortalType portalType) { _securityService = securityService; _userManagementService = userManagementService; _loggingService = loggingService; _cookieName = "DEALNET_AUTH_COOKIE_" + portalType.ToString().ToUpper(); }
public bool StartUp(PortalType portal) { if (ContextPortal != portal) { ContextPortal = portal; } return(true); }
public bool StartUp(PortalType portal) { if (ContextPortal != portal) { ContextPortal = portal; } return true; }
/// <summary> /// Creates a GridPortal instance. /// </summary> /// <param name="name">The name.</param> /// <param name="type">The type of the portal.</param> /// <param name="direction">The direction of the portal.</param> /// <param name="portalOne">The bounds of the first portal.</param> /// <param name="portalTwo">The bounds of the second portal.</param> /// <param name="exclusiveTo">The attribute mask to indicate if this portal is exclusive to (only available to) certain units.</param> /// <param name="action">The action that handles moving between portals.</param> /// <returns>The portal instance</returns> public static GridPortal Create(string name, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action) { var p = new GridPortal(); p.Initialize(name, type, direction, portalOne, portalTwo, exclusiveTo, action); return(p); }
/// <summary> /// 门户创建待审批的单据(通过引擎) 2012-08-03 /// </summary> /// <param name="FormID"></param> /// <param name="FormName"></param> public static void CreateFormFromMvcPlat(string StrFormID, string StrFormName, string StrFormType) { FormID = StrFormID; FormName = StrFormName; FormType = StrFormType; EnumPort = PortalType.AspMVC; ChecResource(); CheckPermission(FormName); }
public MaplePortal(string name, string script, string spawn, Vector2 pos, int to, int pt) { ScriptName = script; SpawnName = spawn; PortalName = name; Location = pos; toMapId = to; Type = TypeByInt(pt); }
/// <summary> /// Creates a runtime Portal instance. /// </summary> /// <typeparam name="TAction">The type of the action.</typeparam> /// <param name="host">The host GameObject.</param> /// <param name="type">The portal type.</param> /// <param name="direction">The direction of the portal.</param> /// <param name="portalOne">The bounds of the first portal.</param> /// <param name="portalTwo">The bounds of the second portal.</param> /// <param name="relativeToTransform">Controls whether the given bounds are treated as relative to the host transform.</param> /// <param name="portalName">Name of the portal.</param> /// <returns>The portal</returns> public static GridPortalComponent Create <TAction>(GameObject host, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, bool relativeToTransform, string portalName) where TAction : Component, IPortalAction { host.AddComponent <TAction>(); var p = host.AddComponent <RuntimeGridPortalComponent>(); p.Configure(type, direction, portalOne, portalTwo, relativeToTransform, portalName); return(p); }
public static ThreadSafeList <Article> ScrapPortal(PortalType type) { var web = new HtmlWeb(); var articles = new ThreadSafeList <Article>(); if (type == PortalType.H24) { string[] datas = new string[3] { "", "", "" }; List <string> links = new(); using (var wc = new WebClient()) { int count = 0; foreach (var url in H24.URLs) { try { datas[count] = wc.DownloadString(url); } catch { datas[count] = ""; } count++; } } foreach (var data in datas) { foreach (var lnk in data.Split(new[] { "<link>" }, StringSplitOptions.None)) { foreach (var sublink in lnk.Split(new[] { "</link>" }, StringSplitOptions.None)) { if (sublink.StartsWith("http") && !sublink.Equals(H24.BaseUrl1) && !sublink.Equals(H24.BaseUrl2)) { links.Add(sublink); } } } } foreach (var link in links) { if (!link.Equals(H24.BaseUrl1) && !link.Equals(H24.BaseUrl2) && link.Contains(H24.BaseUrl1)) { using (var wc = new WebClient()) { var d = ""; var article = new Article(); try { article.Link = link; var i = link[(link.LastIndexOf("/") + 1)..];
public static ThreadSafeList <Article> CreateList(PortalType type) { ThreadSafeList <Article> articles = new(); string path = "", portal = ""; if (type == PortalType.H24) { path = "html/articles/24h"; portal = "24sata.hr"; } else if (type == PortalType.Index) { path = "html/articles/index"; portal = "index.hr"; } else if (type == PortalType.Jutarnji) { path = "html/articles/jutarnji"; portal = "jutarnji.hr"; } else if (type == PortalType.Vecernji) { path = "html/articles/vecernji"; portal = "vecernji.hr"; } else if (type == PortalType.Net) { path = "html/articles/net"; portal = "net.hr"; } articles = HapScrap.ScrapPortal(type); Console.WriteLine($"Scrapped {portal} -> Total articles: {articles.Count(a => true)}"); articles = UpdateList(articles, type); ClearDirectory(path); ThreadSafeList <string> remove = new(); articles.ForEach(a => { try { File.WriteAllText(path + "/" + a.ID + ".html", a.ToHtml(type)); } catch { remove.Add(a.ID); } }); remove.ForEach(s => articles.Remove(a => a.ID.Equals(s))); remove.Clear(); remove = null; return(articles); }
internal void Configure(PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, bool relativeToTransform, string portalName) { this.type = type; this.direction = direction; this.portalOne = portalOne; this.portalTwo = portalTwo; this.relativeToTransform = relativeToTransform; this.portalName = portalName; base.Awake(); OnStartAndEnable(); }
public Portal(PortalType ptype, DateTime date) { UID = new PortalSerial(); PortalType = ptype; DateStarted = date; Mobs = new List <Mobile>(); PortalCrystals = new List <PortalCrystal>(); ParticipantsScores = new Dictionary <PlayerMobile, int>(); BossSpawned = false; CurrentParticipants = new List <Mobile>(); GetPortalLocation(); StartPortal(); }
public void TeleportTo(int destination, PortalType portalType) { if (portalType == PortalType.Open) { levelManager.SetReturnPortal(destination, level.room); level.Load(destination, false, destination); } else if (portalType == PortalType.Return) { level.Load(destination, true, level.room); } UpdateBackground(); }
private void LevelFinished(PortalType portalType) { currentStreak.value++; if (currentStreak.value > bestStreak.value) { bestStreak.value = currentStreak.value; bestStreakDisplay.Display(); //TODO aca habria q tirar animacion de haber mejorado el best score } currentStreakDisplay.Display(); EventManager.OnPlayerReceiveRewards(); levelManager.UnloadLevel(); levelManager.LoadLevel(portalType); }
public Portal(PortalType ptype, DateTime date) { UID = new PortalSerial(); PortalType = ptype; DateStarted = date; Mobs = new List<Mobile>(); PortalCrystals = new List<PortalCrystal>(); ParticipantsScores = new Dictionary<PlayerMobile, int>(); BossSpawned = false; CurrentParticipants = new List<Mobile>(); GetPortalLocation(); StartPortal(); }
public bool ShouldBeDisplayed(PortalType type) { if (type == PortalType.H24) { if (Title.ToLowerInvariant().Contains("igraj i osvoji") || Title.ToLowerInvariant().Contains("osvojite") || Title.ToLowerInvariant().Contains("kupon") || Title.ToLowerInvariant().Contains("prijavi se")) { return(false); } if (Author.ToLowerInvariant().Contains("promo") || Author.ToLowerInvariant().Contains("sponzor") || Author.ToLowerInvariant().Contains("plaćeni") || Author.ToLowerInvariant().Contains("oglas")) { return(false); } if (Content.ToLowerInvariant().Contains("pravila korištenja osobnih podataka") || Content.ToLowerInvariant().Contains("pravila privatnosti") || Content.ToLowerInvariant().Contains("prijavi se")) { return(false); } } else if (type == PortalType.Jutarnji) { if (ID.ToLowerInvariant().Contains("https:--") || ID.ToLowerInvariant().Contains("-vijesti-zagreb")) { return(false); } } else if (type == PortalType.Vecernji) { if (Author.ToLowerInvariant().Contains("pr članak")) { return(false); } } else if (type == PortalType.Net) { if (ID.ToLowerInvariant().Contains("https:")) { return(false); } } if (Author.Equals("<i>nema autora</i>")) { return(false); } return(true); }
public override string ToString() { return //Unknown_28h.Bin + ", (" + Unknown_28h_8a.ToString() + ", " + Unknown_28h_8b.ToString() + "), " + (Unknown_00h.ToString() + ", " + //IndexFlags.ToString() + ", " + IndexCount.ToString() + ", " + //IndexUnk.ToString() + ", " + IndexID.ToString() + ", " + AreaID.ToString() + ", " + CellAABB.ToString() + ", " + Unknown_24h.Hex + ", " + Unknown_28h.Hex + ", " + //PartFlags.ToString() + ", " + //PartUnk1.ToString() + ", " + PartID.ToString() + ", " + PortalType.ToString() + ", " + PortalLinkID.ToString()); }
private void UpdatePortalHeading(Character character, PortalType type, double value) { Portal portal = null; for (int i = 0; i < character.Portals.Count; i++) { if (character.Portals[i].Type.Equals(type)) { portal = character.Portals[i]; character.Portals.RemoveAt(i); break; } } if (portal != null) { portal.Heading = value; } else { portal = new Portal { Type = type, Heading = value }; } character.Portals.Add(portal); if (Parent.Machine.Utility.CharacterSettings.Characters.Contains(character)) { for (int i = 0; i < Parent.Machine.Utility.CharacterSettings.Characters.Count; i++) { if (Parent.Machine.Utility.CharacterSettings.Characters[i].Equals(character)) { Parent.Machine.Utility.CharacterSettings.Characters[i] = character; break; } } } else { Parent.Machine.Utility.CharacterSettings.Characters.Add(character); } Parent.Machine.Utility.SaveCharacterSettings(); }
public PortalInstance(PortalInfo baseInfo, Board board, int x, int y, bool beforeAdding, string pn, PortalType pt, string tn, int tm, string script, int?delay, MapleBool hideTooltip, MapleBool onlyOnce, int?horizontalImpact, int?verticalImpact, string image, int?hRange, int?vRange) : base(board, x, y, -1, beforeAdding) { this.baseInfo = baseInfo; _pn = pn; _pt = pt; _tn = tn; _tm = tm; _script = script; _delay = delay; _hideTooltip = hideTooltip; _onlyOnce = onlyOnce; _horizontalImpact = horizontalImpact; _verticalImpact = verticalImpact; _image = image; _hRange = hRange; _vRange = vRange; }
private void Initialize(string name, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action) { _type = type; _direction = direction; _exclusiveTo = exclusiveTo; _portalOneBounds = portalOne; _portalTwoBounds = portalTwo; _cellOne = new PortalCell(this, false, action); _cellTwo = new PortalCell(this, _direction == PortalDirection.Oneway, action); _gridOne = _cellOne.Initialize(_cellTwo, portalOne); _gridTwo = _cellTwo.Initialize(_cellOne, portalTwo); if (_gridOne == null || _gridTwo == null) { throw new ArgumentException("A grid portal has been placed with one or more of its portals outside a grid. Portals must be on a grid."); } _name = GridManager.instance.RegisterPortal(name, this); }
GameObject getRandomPortal(PortalType type, bool activeStatus) { ArrayList matches = new ArrayList(); Transform portals = (type == PortalType.ORANGE) ? oranges.transform : purples.transform; foreach (Transform child in portals) { if (child.gameObject.activeSelf == activeStatus) { matches.Add(child.gameObject); } } if (matches.Count == 0) { return(null); } int index = Random.Range(0, matches.Count); return((GameObject)matches[index]); }
public GameObject GetRandomMap(PortalType portalType) { GameObject map; switch (portalType) { case PortalType.Dark: this.lightReward = 0; this.darkReward = 1; map = SelectMap(darkMapsInThisRange, ref lastDarkMapBuffer); break; case PortalType.Light: this.lightReward = 1; this.darkReward = 0; map = SelectMap(lightMapsInThisRange, ref lastLightMapBuffer); break; default: case PortalType.Normal: this.darkReward = 0; this.lightReward = 0; map = SelectMap(normalMapsInThisRange, ref lastNormalMapBuffer); break; } return(map); }
public void LoadLevel(PortalType portalType) { bool inRange = false; int i = 0; while (!inRange && i < allTheLevels.levels.Length) { if (allTheLevels.levels[i].levelRangeMax > currentStreak.value) { inRange = true; this.currentMap = allTheLevels.levels[i].GetRandomMap(portalType); //actualizo las rewards this.levelCoinReward.value = (currentStreak.value + 1) * allTheLevels.levels[i].levelRangeMax; this.levelShotReward.value = allTheLevels.levels[i].shotsReward; this.levelLightReward.value = allTheLevels.levels[i].lightReward; this.levelDarkReward.value = allTheLevels.levels[i].darkReward; } i++; } // se terminaron los stages de mapas, lo mantengo en el ultimo if (!inRange) { i--; this.currentMap = allTheLevels.levels[i].GetRandomMap(portalType); // estos 2 pueden cambiar solo por el portal que se elije, shots y coins dependen // del stage en el que esta,y si no hay mas stages se mantienen como aca. this.levelLightReward.value = allTheLevels.levels[i].lightReward; this.levelDarkReward.value = allTheLevels.levels[i].darkReward; } this.currentMap = Instantiate(this.currentMap); this.startingPosition = this.currentMap.transform.Find("StartingPosition"); StartGame(); }
public void OnPortalTrigger(PortalType type, Component c, GameObject origin) { if (c == null) { return; } if (portalsActive && c.gameObject.CompareTag("Ball")) { GameObject ball = c.gameObject; GameObject otherPortal = null; activationTimer = 0; portalsActive = false; switch (type) { case PortalType.PURPLE: otherPortal = getRandomPortal(PortalType.ORANGE, ACTIVE); break; case PortalType.ORANGE: otherPortal = getRandomPortal(PortalType.PURPLE, ACTIVE); break; } if (otherPortal == null) { return; } Vector3 destination = otherPortal.GetComponent <PortalTrigger> ().GetTranportPoint(); transport(ball, destination); otherPortal.SetActive(false); origin.SetActive(false); ball.GetComponent <UniversalBallController>().ResetVelocity(); } }
private static void LoadPortals(WzImage mapImage, Board mapBoard) { WzSubProperty portalParent = (WzSubProperty)mapImage["portal"]; foreach (WzSubProperty portal in portalParent.WzProperties) { int x = InfoTool.GetInt(portal["x"]); int y = InfoTool.GetInt(portal["y"]); PortalType pt = (PortalType)InfoTool.GetInt(portal["pt"]); int tm = InfoTool.GetInt(portal["tm"]); string tn = InfoTool.GetString(portal["tn"]); string pn = InfoTool.GetString(portal["pn"]); string image = InfoTool.GetOptionalString(portal["image"]); string script = InfoTool.GetOptionalString(portal["script"]); int? verticalImpact = InfoTool.GetOptionalInt(portal["verticalImpact"]); int? horizontalImpact = InfoTool.GetOptionalInt(portal["horizontalImpact"]); int? hRange = InfoTool.GetOptionalInt(portal["hRange"]); int? vRange = InfoTool.GetOptionalInt(portal["vRange"]); int? delay = InfoTool.GetOptionalInt(portal["delay"]); MapleBool hideTooltip = InfoTool.GetOptionalBool(portal["hideTooltip"]); MapleBool onlyOnce = InfoTool.GetOptionalBool(portal["onlyOnce"]); mapBoard.BoardItems.Portals.Add(PortalInfo.GetPortalInfoByType(pt).CreateInstance(mapBoard, x, y, false, pn, tn, tm, script, delay, hideTooltip, onlyOnce, horizontalImpact, verticalImpact, image, hRange, vRange)); } }
public PortalInstance(PortalInfo baseInfo, Board board, int x, int y, bool beforeAdding, string pn, PortalType pt, string tn, int tm, string script, int? delay, MapleBool hideTooltip, MapleBool onlyOnce, int? horizontalImpact, int? verticalImpact, string image, int? hRange, int? vRange) : base(board, x, y, -1, beforeAdding) { this.baseInfo = baseInfo; _pn = pn; _pt = pt; _tn = tn; _tm = tm; _script = script; _delay = delay; _hideTooltip = hideTooltip; _onlyOnce = onlyOnce; _horizontalImpact = horizontalImpact; _verticalImpact = verticalImpact; _image = image; _hRange = hRange; _vRange = vRange; }
public CEventTransferArgs(PortalType t, uint id) { type = t; targetID = id; }
public PortalInfo(PortalType type, Bitmap image, System.Drawing.Point origin, IWzObject parentObject) : base(image, origin, parentObject) { this.type = type; }
/// <summary>Returns a new instance of the appropriate class of an object based on its object ID.</summary> /// <param name="objectID">The object ID of the new object.</param> public static GeneralObject GetNewObjectInstance(PortalType objectID) => GetNewObjectInstance((int)objectID);
public static CommonViewModel CreateCommonViewModel(int clientId, int portalId, PortalType portalType, PortalUIConfiguration configuration, string selectedModule) { CommonViewModel commonViewModel = new CommonViewModel(); commonViewModel.HeaderViewModel = CreateHeaderViewModel(clientId, portalId, portalType, configuration, selectedModule); commonViewModel.FooterViewModel = CreateFooterViewModel(configuration); return commonViewModel; }
//straight up distance from given position to portal pos public float DistToPortal(PortalType portal, Vector3 ptToTest) { ptToTest.y = 0.0f; Vector3 portalPos = GetPortalPos(portal); portalPos.y = 0.0f; return (portalPos - ptToTest).magnitude; }
public Vector3 GetPortalDir(PortalType portal) { if (portal == PortalType.EntrancePortal) return GetSegmentDirection(_entrancePortalSegment-1); else if (portal == PortalType.EntrancePortal2) return GetSegmentDirection(_entrancePortal2Segment-1); else return GetSegmentDirection(_exitPortalSegment-1); }
/// <summary>Creates a new instance of the <seealso cref="ObjectIDAttribute"/> attribute.</summary> /// <param name="objectID">The object ID of the <seealso cref="Portal"/>.</param> public ObjectIDAttribute(PortalType objectID) : this((int)objectID) { }
public static ArticlePartialViewModel CreateArticlePartialViewModel(ArticleItem articleItem, ArticleModule articleModule, ArrayList categoryNamesList, ArrayList attributeNamesList, PortalType portalType, Dictionary<string, string> resources, int clientId, int portalId, string adminURL) { ArticlePartialViewModel articlePartialViewModel = new ArticlePartialViewModel(); DataConfigurationRepository dataConfigurationRepository = new DataConfigurationRepository(HttpContext.Current.Application["KBDataPath"].ToString(), HttpContext.Current.Application["KBInstallPath"].ToString()); articlePartialViewModel.Resources = resources; articlePartialViewModel.ArticleItem = articleItem; articlePartialViewModel.clientId = clientId; articlePartialViewModel.portalId = portalId; if (articleModule != null) { articlePartialViewModel.ArticleConfiguration = articleModule; } else { //---- set defaults ------ } List<BreadcrumbViewModel> categories = new List<BreadcrumbViewModel>(); foreach (List<string> names in categoryNamesList) { BreadcrumbViewModel itemList = new BreadcrumbViewModel(); itemList.NavigationList = new List<SelectListItem>(); foreach (string name in names) { itemList.NavigationList.Add(new SelectListItem() { Text = name, Value = string.Empty, Selected = false }); } categories.Add(itemList); } articlePartialViewModel.Categories = categories; articlePartialViewModel.Attributes = new List<BreadcrumbViewModel>(); List<BreadcrumbViewModel> attr = new List<BreadcrumbViewModel>(); foreach (List<string> names in attributeNamesList) { BreadcrumbViewModel itemList = new BreadcrumbViewModel(); itemList.NavigationList = new List<SelectListItem>(); foreach (string name in names) { itemList.NavigationList.Add(new SelectListItem() { Text = name, Value = string.Empty, Selected = false }); } attr.Add(itemList); } articlePartialViewModel.Attributes = attr; articlePartialViewModel.ImageLinks = new List<ImageLinkViewModel>(); ImageLinkViewModel imageLinkViewModel; //check Favorite is enabled if (articlePartialViewModel.ArticleConfiguration.articleControlsProperties.ArticleFavoriteDisplay) { imageLinkViewModel = new ImageLinkViewModel() { Icon = (articlePartialViewModel.ArticleItem.Favorite == true && (portalType != PortalType.Open && portalType != PortalType.Registration)) ? @Utilities.GetImageUrl(clientId, portalId, "favoriteactive.png") : @Utilities.GetImageUrl(clientId, portalId, "favorite.png"), Link = "/Article/FavoriteArticle/" + clientId + "/" + portalId, Title = Utilities.GetResourceText(resources, "CONTROLS_FAVORITELABEL"), ToggleIcon = (articlePartialViewModel.ArticleItem.Favorite == true || portalType == PortalType.Open || portalType == PortalType.Registration) ? @Utilities.GetImageUrl(clientId, portalId, "favorite.png") : @Utilities.GetImageUrl(clientId, portalId, "favoriteactive.png") }; imageLinkViewModel.Id = "favorites"; articlePartialViewModel.ImageLinks.Add(imageLinkViewModel); } //check Subscription is enabled if (articlePartialViewModel.ArticleConfiguration.articleControlsProperties.ArticleSubscribeDisplay) { imageLinkViewModel = new ImageLinkViewModel() { Icon = @Utilities.GetImageUrl(clientId, portalId, "subscribe.png"), Link = "", Title = Utilities.GetResourceText(resources, "CONTROLS_SUBSCRIBELABEL"), ToggleIcon = @Utilities.GetImageUrl(clientId, portalId, "subscribe_selected.png") }; // imageLinkViewModel = new ImageLinkViewModel() { Icon = (articlesViewModel.ArticlePartialViewModel.ArticleItem.SubscriptionStatus == true && (_portal.PortalType != PortalType.Open && _portal.PortalType != PortalType.Registration)) ? @Utilities.GetImageUrl(clientId, portalId, "subscribe_select.png") : @Utilities.GetImageUrl(clientId, portalId, "subscribe.png"), Link = "/Article/ToggleArticleSubscription/" + clientId + "/" + portalId, Title = Utilities.GetResourceText(resources, "CONTROLS_SUBSCRIBELABEL"), ToggleIcon = (articlesViewModel.ArticlePartialViewModel.ArticleItem.SubscriptionStatus == true || _portal.PortalType == PortalType.Open || _portal.PortalType == PortalType.Registration) ? @Utilities.GetImageUrl(clientId, portalId, "subscribe.png") : @Utilities.GetImageUrl(clientId, portalId, "subscribe.png") }; //imageLinkViewModel = new ImageLinkViewModel() { Icon = @Utilities.GetImageUrl(clientId, portalId, "subscribe.png"), Link = "", Title = Utilities.GetResourceText(resources,"CONTROLS_SUBSCRIBELABEL"), ToggleIcon = @Utilities.GetImageUrl(clientId, portalId, "subscribe.png") }; imageLinkViewModel.Id = "subscribe"; articlePartialViewModel.ImageLinks.Add(imageLinkViewModel); } //Check share is enabled if (articlePartialViewModel.ArticleConfiguration.articleControlsProperties.ArticleShareDisplay) { imageLinkViewModel = new ImageLinkViewModel() { Icon = @Utilities.GetImageUrl(clientId, portalId, "share.png"), Link = "", Title = Utilities.GetResourceText(resources, "CONTROLS_SHARELABEL"), ToggleIcon = @Utilities.GetImageUrl(clientId, portalId, "share_selected.png") }; imageLinkViewModel.Id = "share"; articlePartialViewModel.ImageLinks.Add(imageLinkViewModel); } if (articlePartialViewModel.ArticleConfiguration.articleControlsProperties.ArticleEditDisplay) { imageLinkViewModel = new ImageLinkViewModel() { Icon = @Utilities.GetImageUrl(clientId, portalId, "edit.png"), Link = adminURL + "/index.aspx?aid=", Title = Utilities.GetResourceText(resources, "CONTROLS_EDITLABEL"), ToggleIcon = @Utilities.GetImageUrl(clientId, portalId, "edit.png") }; imageLinkViewModel.Id = "edit"; articlePartialViewModel.ImageLinks.Add(imageLinkViewModel); } articlePartialViewModel.Attachments = articleItem.Attachments; return articlePartialViewModel; }
/// <summary> /// Creates a GridPortal instance. /// </summary> /// <param name="name">The name.</param> /// <param name="type">The type of the portal.</param> /// <param name="portalOne">The bounds of the first portal.</param> /// <param name="portalTwo">The bounds of the second portal.</param> /// <param name="exclusiveTo">The attribute mask to indicate if this portal is exclusive to (only available to) certain units.</param> /// <param name="action">The action that handles moving between portals.</param> /// <returns>The portal instance</returns> public static GridPortal Create(string name, PortalType type, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action) { return Create(name, type, PortalDirection.Twoway, portalOne, portalTwo, exclusiveTo, action); }
private static HeaderViewModel CreateHeaderViewModel(int clientId, int portalId, PortalType portalType, PortalUIConfiguration configuration, string selectedModule) { try { HeaderViewModel headerViewModel = new HeaderViewModel(); headerViewModel.NavigationList = new List<SelectListItem>(); headerViewModel.BeforePortal = configuration.BeforePortal; headerViewModel.portalId = portalId; headerViewModel.clientId = clientId; headerViewModel.portalType = portalType; List<PortalModule> OrderedModuleList = configuration.Modules.OrderBy(x => x.DisplayOrder).ToList(); List<PortalModule> SelectedModuleList = OrderedModuleList.Where(x => x.Display == true).ToList(); if (configuration.ShowPortalNavigation) { foreach (PortalModule module in SelectedModuleList) { SelectListItem navItem = new SelectListItem() { Text = module.ModuleName, Value = module.ModuleType, Selected = false }; if (module.ModuleType == selectedModule) { navItem.Selected = true; } if (module.ModuleType == "articles") { navItem.Value = "article"; } headerViewModel.NavigationList.Add(navItem); } } if (HttpContext.Current.Session["UserSession_" + portalId.ToString()] != null) { var usr = (User)HttpContext.Current.Session["UserSession_" + portalId.ToString()]; if (usr != null) { headerViewModel.isActiveDiretoryUser = usr.isActiveDirectoryUser; } } return headerViewModel; } catch (Exception ex) { KBCustomException kbCustExp = KBCustomException.ProcessException(ex, KBOp.CreateViewModel, KBErrorHandler.GetMethodName(), GeneralResources.CreateViewModelError, new KBExceptionData("clientId", clientId), new KBExceptionData("portalType", portalType), new KBExceptionData("selectedModule", selectedModule), new KBExceptionData("configuration.AfterPortal", configuration.AfterPortal)); throw kbCustExp; } }
/// <summary> /// Creates a GridPortal instance. /// </summary> /// <param name="name">The name.</param> /// <param name="type">The type of the portal.</param> /// <param name="direction">The direction of the portal.</param> /// <param name="portalOne">The bounds of the first portal.</param> /// <param name="portalTwo">The bounds of the second portal.</param> /// <param name="exclusiveTo">The attribute mask to indicate if this portal is exclusive to (only available to) certain units.</param> /// <param name="action">The action that handles moving between portals.</param> /// <returns>The portal instance</returns> public static GridPortal Create(string name, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action) { var p = new GridPortal(); p.Initialize(name, type, direction, portalOne, portalTwo, exclusiveTo, action); return p; }
public Vector3 GetPortalPos(PortalType portal) { int portalIdx = -1; if (portal == PortalType.EntrancePortal) portalIdx = _entrancePortalSegment; else if (portal == PortalType.EntrancePortal2) portalIdx = _entrancePortal2Segment; else if (portal == PortalType.ExitPortal) portalIdx = _exitPortalSegment; if (portalIdx >= 0) return Path.Points[portalIdx].GetPos(); else return Vector3.zero; }
public Nights2Spot GetPortalSpot(PortalType portal) { int portalIdx = -1; if (portal == PortalType.EntrancePortal) portalIdx = _entrancePortalSegment; else if (portal == PortalType.EntrancePortal2) portalIdx = _entrancePortal2Segment; else if (portal == PortalType.ExitPortal) portalIdx = _exitPortalSegment; if (portalIdx >= 0) return Path.Points[portalIdx].Spot; else return null; }
public static PortalInfo GetPortalInfoByType(PortalType type) { return Program.InfoManager.Portals[(int)type]; }
//get position relative to the portal, both along the vector in the forward direction of the portal, and normal to its direction public void GetPortalRelativePos(PortalType portal, Vector3 ptToTest, out float forwardDist, out float sideDist) { ptToTest.y = 0.0f; Vector3 portalPos = GetPortalPos(portal); portalPos.y = 0.0f; Vector3 portalDir = GetPortalDir(portal); Vector3 fromPortal = (portalPos - ptToTest); Vector3 projectedPos = Vector3.Project(fromPortal, portalDir); forwardDist = Mathf.Sign(Vector3.Dot(fromPortal, portalDir))*projectedPos.magnitude; //Debug.Log("forward projected: " + projectedPos); Vector3 sideDir = Vector3.Cross(portalDir, Vector3.up); projectedPos = Vector3.Project(fromPortal, sideDir); //Debug.Log("side projected: " + projectedPos); sideDist = Mathf.Sign(Vector3.Dot(fromPortal, sideDir)) * projectedPos.magnitude; }