private void DisAbleEntity() { if (inPlay) { waitTime += Time.deltaTime; if (waitTime > 1f) { foreach (KeyValuePair <string, List <ElementItem> > item in ElementContainer.GetInstance().dicElements) { foreach (ElementItem itemElement in item.Value) { if (itemElement != ElementContainer.GetInstance().nowElement) { itemElement.gameObject.SetActive(false); } } } foreach (Transform itemArray in ElementContainer.GetInstance().arrayLabelParent) { itemArray.gameObject.SetActive(false); } waitTime = 0f; } } }
//pass on all of one element container to another public void GiveOneElement(ElementContainer recipientContainer) { string elementName = recipientContainer.contents.name; int allVol = GetElementContainerByName(elementsInventory, elementName).volume; GiveOneElementAmount(recipientContainer, allVol); }
// this function was made to insert player in correct position in SwapPlayerModeTool // CAUTION!! dont check if has layer or if it is allowed, because where it is call that has been checked // dont call to setPlayerLayer() because it has been checked public void restorePlayer() { ElementContainer ec = new ElementContainer(null, sceneDataControl.getPlayerLayer(), AssetsController.getImage(this.playerImagePath)); int layer = insertInOrder(ec, true); reassignLayerAllReferencesDataControl(layer); }
/// <summary> /// 设置目标物体 /// </summary> /// <param name="_target"></param> public void SetTarget(Transform _target, Vector3 _initPos, bool _exist = true) { initPos = _initPos; posNum = 0; exist = _exist; target = _target; d_Length = 0f; z_Degree = 0f; target.localPosition = listPos[0]; Vector3 temp = new Vector3(); for (int i = 0; i < listPos.Count; i++) { if (i + 1 < listPos.Count) { d_Length += Vector3.Distance(listPos[i], listPos[i + 1]); } } foreach (Vector3 item in listPos) { Vector3 temp1 = ElementContainer.GetInstance().transform.TransformPoint(item); temp += temp1; } Camera.main.GetComponent <BLCameraControl>().LookAtPosition3(temp / listPos.Count); }
void Update() { if (ElementContainer.GetInstance().isCurrent) { if (Input.GetMouseButtonDown(0)) { drawRectangle = true; //如果鼠标左键按下 设置开始画线标志 start = Input.mousePosition; //记录按下位置 } else if (Input.GetMouseButtonUp(0)) { drawRectangle = false; //如果鼠标左键放开 结束画线 CheckSelection(start, Input.mousePosition); //框选物体 string resSelectList = ""; foreach (ElementItem item in ElementContainer.GetInstance().listSelectItems) { resSelectList += "{\"resId\":\"" + item.name + "\",\"t_eCode\":\"" + item.t_eType + "\"},"; } if (!string.IsNullOrEmpty(resSelectList)) { resSelectList = "[" + resSelectList + "]"; resSelectList = resSelectList.Remove(resSelectList.LastIndexOf(","), 1);; //移除掉最后一个"," } GameObject.Find("JSInterface").GetComponent <JSInterface>().selectCurrentResList(resSelectList); } } }
public Submodel() { SubmodelElements = new ElementContainer <ISubmodelElement>(); MetaData = new Dictionary <string, string>(); EmbeddedDataSpecifications = new List <IEmbeddedDataSpecification>(); Constraints = new List <IConstraint>(); }
void OnCollisionEnter2D(Collision2D collision2d) { Debug.Log("player collided with: " + collision2d.gameObject.name); //this is here in order to ignore collisions with the box colliders of the ground tiles if (collision2d.gameObject.layer == 8) { Physics2D.IgnoreLayerCollision(8, 22, true); } //if player collides with ElementBox, attempt to add ElementContainer to player's element inventory if (collision2d.gameObject.layer == 25) { //trying the separate inventory class here ElementContainer temp = collision2d.gameObject.GetComponent <ElementBox> ().container; bool elementsAdded = inventory.GetComponent <InventoryManager> ().playerInventory.AddElementContainerToInventory(temp); if (elementsAdded) { Destroy(collision2d.gameObject); //remove the ElementBox after contents absorbed } else if (!elementsAdded) { //if we can't add all try adding part of the container inventory.GetComponent <InventoryManager> ().playerInventory.PartialElementAdd(temp); //don't destroy the container } else { //if unable to add elements, display message //this should be an in game UI message // Debug.Log("Could not add " + temp.volume + " " + temp.contents.name + " to player inventory, because amount exceeds carrying capacity."); messages.CreateMessage("Could not add " + temp.volume + " " + temp.contents.name + " to player inventory, because amount exceeds carrying capacity.", playerIdentifier); } } }
public async Task <IActionResult> PutElementContainer(long id, ElementContainer elementContainer) { if (id != elementContainer.ElementContainerId) { return(BadRequest()); } _context.Entry(elementContainer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ElementContainerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void AddBasicSupportingToken(SecurityToken token, SecurityTokenParameters parameters) { if (token == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token)); } if (parameters == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parameters)); } ThrowIfProcessingStarted(); SendSecurityHeaderElement tokenElement = new SendSecurityHeaderElement(token.Id, new TokenElement(token, StandardsManager)) { MarkedForEncryption = true }; ElementContainer.AddBasicSupportingToken(tokenElement); HasEncryptedTokens = true; HasSignedTokens = true; AddParameters(ref _basicSupportingTokenParameters, parameters); if (_basicTokens == null) { _basicTokens = new List <SecurityToken>(); } // We maintain a list of the basic tokens for the SignThenEncrypt case as we will // need this token to write STR entry on OnWriteHeaderContents. _basicTokens.Add(token); }
public IResult <IElementContainer <ISubmodelDescriptor> > RetrieveSubmodels(string aasId) { if (string.IsNullOrEmpty(aasId)) { return(new Result <ElementContainer <ISubmodelDescriptor> >(new ArgumentNullException(nameof(aasId)))); } string aasIdHash = GetHashString(aasId); string aasDirectoryPath = Path.Combine(FolderPath, aasIdHash); if (Directory.Exists(aasDirectoryPath)) { ElementContainer <ISubmodelDescriptor> submodelDescriptors = new ElementContainer <ISubmodelDescriptor>(); string submodelDirectoryPath = Path.Combine(aasDirectoryPath, SubmodelFolder); if (Directory.Exists(submodelDirectoryPath)) { string[] files = Directory.GetFiles(submodelDirectoryPath); foreach (var file in files) { string submodelId = file.Split(Path.DirectorySeparatorChar)?.Last()?.Replace(".json", ""); var descriptor = RetrieveSubmodel(aasId, submodelId); if (descriptor.Success && descriptor.Entity != null) { submodelDescriptors.Create(descriptor.Entity); } } } return(new Result <ElementContainer <ISubmodelDescriptor> >(true, submodelDescriptors)); } else { return(new Result <ElementContainer <ISubmodelDescriptor> >(false, new NotFoundMessage($"Asset Administration Shell with {aasId}"))); } }
public void AddEndorsingSupportingToken(SecurityToken token, SecurityTokenParameters parameters) { if (token == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token)); } if (parameters == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parameters)); } ThrowIfProcessingStarted(); ElementContainer.AddEndorsingSupportingToken(token); // The ProviderBackedSecurityToken was added for the ChannelBindingToken (CBT) effort for win7. // We can assume the key is of type symmetric key. // // Asking for the key type from the token will cause the ProviderBackedSecurityToken // to attempt to resolve the token and the nego will start. // // We don't want that. // We want to defer the nego until after the CBT is available in SecurityAppliedMessage.OnWriteMessage. //TODO //if (!(token is ProviderBackedSecurityToken)) //{ // this.shouldSignToHeader |= (!this.RequireMessageProtection) && (SecurityUtils.GetSecurityKey<AsymmetricSecurityKey>(token) != null); //} AddParameters(ref _endorsingTokenParameters, parameters); }
internal override Element Parse(XElement element) { base.ParseXml(element); if (element.HasElements) { List <Element> nodes = new List <Element>(); element.Elements().ToList().ForEach(entry => { string nodeName = entry.Name.LocalName; if (ElementContainer.Contains(nodeName)) { nodes.Add(ElementContainer .Resolve(nodeName) .Parse(entry)); } }); Element cmd = nodes.Where(entry => (entry is Command)).FirstOrDefault(); this.command = cmd == null ? null : (cmd as Command); nodes .Where(transition => (transition is Transition)) .ToList() .ForEach(g => { this.Transitions.Add(g as Transition); }); } return(this); }
private void CompleteEncryption() { ISecurityElement referenceList = CompleteEncryptionCore( ElementContainer.PrimarySignature, ElementContainer.GetBasicSupportingTokens(), ElementContainer.GetSignatureConfirmations(), ElementContainer.GetEndorsingSignatures()); if (referenceList == null) { // null out all the encryption fields since there is no encryption needed ElementContainer.SourceEncryptionToken = null; ElementContainer.WrappedEncryptionToken = null; ElementContainer.DerivedEncryptionToken = null; return; } if (_skipKeyInfoForEncryption) { WrappedKeySecurityToken wrappedKeyToken = _encryptingToken as WrappedKeySecurityToken; wrappedKeyToken.EnsureEncryptedKeySetUp(); wrappedKeyToken.EncryptedKey.ReferenceList = (ReferenceList)referenceList; } else { ElementContainer.ReferenceList = referenceList; } _basicTokenEncrypted = true; }
public AssetAdministrationShell() { Submodels = new ElementContainer <ISubmodel>(); Views = new ElementContainer <IView>(); MetaData = new Dictionary <string, string>(); ConceptDictionaries = new ElementContainer <IConceptDictionary>(); EmbeddedDataSpecifications = new List <IEmbeddedDataSpecification>(); }
public static ElementContainer Create(ElementPanel _Panel, int _Axis) { GameObject containerObject = new GameObject("container"); ElementContainer container = containerObject.AddComponent <ElementContainer>(); container.Setup(_Panel, _Axis); return(container); }
public void Select() { Debug.Log("选择" + transform.name); if (!ElementContainer.GetInstance().listSelectItems.Contains(this)) { ElementContainer.GetInstance().listSelectItems.Add(this); } }
private void OnMouseWheel(object sender, MouseWheelEventArgs e) { if (ElementContainer != null) { ElementContainer.ScrollToVerticalOffset(ElementContainer.VerticalOffset + -e.Delta); e.Handled = true; } }
public void DisSelect() { Debug.Log("取消选择" + transform.name); if (ElementContainer.GetInstance().listSelectItems.Contains(this)) { ElementContainer.GetInstance().listSelectItems.Remove(this); } }
private void SignWithSupportingTokens() { SecurityToken[] endorsingTokens = ElementContainer.GetEndorsingSupportingTokens(); if (endorsingTokens != null) { for (int i = 0; i < endorsingTokens.Length; ++i) { SecurityToken source = endorsingTokens[i]; SecurityKeyIdentifierClause sourceKeyClause = _endorsingTokenParameters[i].CreateKeyIdentifierClause(source, GetTokenReferenceStyle(_endorsingTokenParameters[i])); if (sourceKeyClause == null) { throw TraceUtility.ThrowHelperError(new MessageSecurityException(SR.TokenManagerCannotCreateTokenReference), Message); } SecurityToken signingToken; SecurityKeyIdentifierClause signingKeyClause; if (_endorsingTokenParameters[i].RequireDerivedKeys && !_endorsingTokenParameters[i].HasAsymmetricKey) { throw ExceptionHelper.PlatformNotSupported(); } else { signingToken = source; signingKeyClause = sourceKeyClause; } SignWithSupportingToken(signingToken, signingKeyClause); } } SecurityToken[] signedEndorsingSupportingTokens = ElementContainer.GetSignedEndorsingSupportingTokens(); if (signedEndorsingSupportingTokens != null) { for (int i = 0; i < signedEndorsingSupportingTokens.Length; ++i) { SecurityToken source = signedEndorsingSupportingTokens[i]; SecurityKeyIdentifierClause sourceKeyClause = _signedEndorsingTokenParameters[i].CreateKeyIdentifierClause(source, GetTokenReferenceStyle(_signedEndorsingTokenParameters[i])); if (sourceKeyClause == null) { throw TraceUtility.ThrowHelperError(new MessageSecurityException(SR.TokenManagerCannotCreateTokenReference), Message); } SecurityToken signingToken; SecurityKeyIdentifierClause signingKeyClause; if (_signedEndorsingTokenParameters[i].RequireDerivedKeys && !_signedEndorsingTokenParameters[i].HasAsymmetricKey) { throw ExceptionHelper.PlatformNotSupported(); // Derived keys not supported initially } else { signingToken = source; signingKeyClause = sourceKeyClause; } SignWithSupportingToken(signingToken, signingKeyClause); } } }
// Update is called once per frame void Update() { if (ElementContainer.GetInstance().domMode == DomMode.lx || ElementContainer.GetInstance().domMode == DomMode.xj) { if (Input.GetMouseButtonUp(0)) { DoubleClick(); } } }
IEnumerator WaitTime() { yield return(new WaitForSeconds(0.1f)); if (ElementContainer.GetInstance().nowElement != null) { ElementContainer.GetInstance().nowElement.SetUIByLevel(1); } target = null; }
public void AddFallback(ElementContainer fallback) { if (IsFallbackDefined) { throw new BuildException("The <otherwise> element may only" + " be defined once.", Location); } _elementContainers.Add(fallback); }
/** * Insert in order in allReferencesDataControl attribute * * @param element * The element container to be added * @param hasLayer * Take either layer or depth value to order value * @param playerLayer * Take the layer if player has it, or the y position if the * player has not layer. * * @return i returns the position where the element has been inserted. It * will be use to reassign layer */ public int insertInOrder(ElementContainer element, bool hasLayer) { bool added = false; int i = 0; bool empty = allReferencesDataControl.Count == 0; // While the element has not been added, and // we haven't checked every previous element while (!added && (i < allReferencesDataControl.Count || empty)) { if (!empty) { if (hasLayer) { if (element.getLayer() <= allReferencesDataControl[i].getLayer()) { allReferencesDataControl.Insert(i, element); added = true; } } else { if (element.getY() <= Mathf.Round(allReferencesDataControl[i].getY())) { allReferencesDataControl.Insert(i, element); reassignLayerAllReferencesDataControl(i); added = true; } } i++; } else { allReferencesDataControl.Insert(i, element); if (!hasLayer) { reassignLayerAllReferencesDataControl(i); } added = true; i++; } } // If the element wasn't added, add it in the last position if (!added) { //element.setLayer(i); allReferencesDataControl.Add(element); if (!hasLayer) { reassignLayerAllReferencesDataControl(i - 1); } } return(i - 1); }
public ElementContainer[] GetAllControls() { var arr = new ElementContainer[uiControls.Count]; var counter = 0; foreach (var item in uiControls.Keys) { arr[counter++] = new ElementContainer(item.ToString(), (UIElement)uiControls[item]); } return(arr); }
public void addPlayer() { if (sceneDataControl.isForcedPlayerLayer()) { playerImagePath = Controller.getInstance().getPlayerImagePath(); ElementContainer ec = new ElementContainer(null, 0, AssetsController.getImage(this.playerImagePath)); int layer = insertInOrder(ec, true); reassignLayerAllReferencesDataControl(layer); sceneDataControl.setPlayerLayer(layer); } }
//pass on a set amount from one container to another //assumes element container exists since it is passed in public void GiveOneElementAmount(ElementContainer recipientContainer, int volToGive) { string nameToGive = recipientContainer.contents.name; ElementContainer toGive = GetElementContainerByName(elementsInventory, nameToGive); recipientContainer.volume += volToGive; toGive.volume -= volToGive; elementsUpdated = true; // Debug.Log ("Gave " + volToGive + " " + nameToGive + " to another element container."); SendMessage("Gave " + volToGive + " " + nameToGive + " to another element container."); }
public static void BaseSample() { ElementContainer container = new ElementContainer(); container.Attach(new ElementA()); container.Attach(new ElementB()); container.Accept(new VisitorFirst()); container.Accept(new VisitorSecond()); Console.ReadKey(); }
internal override Element Parse(XElement element) { base.ParseXml(element); if (element.HasElements) { List <Element> nodes = new List <Element>(); element.Elements().ToList().ForEach(entry => { string nodeName = entry.Name.LocalName; if (ElementContainer.Contains(nodeName)) { nodes.Add(ElementContainer .Resolve(nodeName) .Parse(entry)); } }); nodes .Where(group => (group is Group)) .ToList() .ForEach(g => { this.Groups.Add(g as Group); }); nodes .Where(transition => (transition is Transition)) .ToList() .ForEach(g => { this.Transitions.Add(g as Transition); }); nodes .Where(actor => (actor is Actor)) .ToList() .ForEach(actor => { this.actors.Add(actor as Actor); }); nodes .Where(action => (action is Action)) .ToList() .ForEach(action => { this.actions.Add(action as Action); }); } return(this); }
/// <summary> /// 重置 /// </summary> public void ResetStart() { listPos.Clear(); dicPosLine.Clear(); isPlay = false; inPlay = false; if (nowTrack != null) { foreach (KeyValuePair <GameObject, bool> item in ElementContainer.GetInstance().dicTrack) { if (item.Key != null) { item.Key.SetActive(item.Value); } } if (exist) { target.position = initPos; foreach (KeyValuePair <string, List <Transform> > item in ElementContainer.GetInstance().dicLineLabels) { if (item.Value.Contains(target)) { if (ElementContainer.GetInstance().arrayLabelParent.Find(item.Key) != null) { ElementContainer.GetInstance().arrayGo = ElementContainer.GetInstance().arrayLabelParent.Find(item.Key).gameObject; ElementContainer.GetInstance().arrayLabelParent.Find(item.Key).gameObject.SetActive(false); } //ElementContainer.GetInstance().level = 1; } } target.GetComponent <ElementItem>().Set(target.GetComponent <ElementItem>().resEntityTemp, false, true); } else { Destroy(target.gameObject); ElementContainer.GetInstance().SceneToLevel(1); exist = true; } ElementContainer.GetInstance().nowElement = target.GetComponent <ElementItem>(); if (ElementContainer.GetInstance().arrayGo != null) { if (ElementContainer.GetInstance().dicTrack.ContainsKey(ElementContainer.GetInstance().arrayGo)) { if (ElementContainer.GetInstance().dicTrack[ElementContainer.GetInstance().arrayGo] == true) { ElementContainer.GetInstance().ResetLabel(true); } } } nowTrack = null; } StartCoroutine(WaitTime()); }
/** * Constructor. * * @param sceneDataControl * Link to the parent scene controller * @param itemReferencesList * List of item references */ public ReferencesListDataControl(string playerImagePath, SceneDataControl sceneDataControl, List <ElementReference> itemReferencesList, List <ElementReference> atrezzoReferencesList, List <ElementReference> npcReferencesList) { this.playerImagePath = playerImagePath; this.sceneDataControl = sceneDataControl; this.itemReferencesList = itemReferencesList; this.atrezzoReferencesList = atrezzoReferencesList; this.npcReferencesList = npcReferencesList; this.allReferencesDataControl = new List <ElementContainer>(); this.lastElementContainer = null; this.playerPositionInAllReferences = NO_PLAYER; this.imagePathHasChanged = false; // Check if one of references has layer -1: if it is true, it means that element references has no layer. // Create subcontrollers bool hasLayerV = hasLayer(); foreach (ElementReference itemReference in itemReferencesList) { int counter = count(itemReference); ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, itemReference, Controller.ITEM_REFERENCE, counter); insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV); } foreach (ElementReference atrezzoReference in atrezzoReferencesList) { int counter = count(atrezzoReference); ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, atrezzoReference, Controller.ATREZZO_REFERENCE, counter); insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV); } foreach (ElementReference npcReference in npcReferencesList) { int counter = count(npcReference); ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, npcReference, Controller.NPC_REFERENCE, counter); insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV); } // insert player // by default, if player don´t have layer, we give it to him. if (playerImagePath != null && (!Controller.getInstance().isPlayTransparent()) && sceneDataControl.isForcedPlayerLayer()) { int layer; if (sceneDataControl.getPlayerLayer() == Scene.PLAYER_WITHOUT_LAYER) { layer = 0; } else { layer = sceneDataControl.getPlayerLayer(); } reassignLayerAllReferencesDataControl(insertInOrder(new ElementContainer(null, layer, AssetsController.getImage(this.playerImagePath)), true)); } }
private static int[] GetTroops(ElementContainer<TableRow> tableRow) { int[] troops = new int[11]; if (tableRow.Exists) { for (int i = 0; i < 10; i++) { troops[i] = Misc.String2Number(tableRow.TableCells[i].Text.Trim()); } int count = tableRow.TableCells.Count; troops[10] = count == 11 ? Misc.String2Number(tableRow.TableCells[10].Text.Trim()) : 0; } return troops; }
public UI() { Container = new ElementContainer(); }
public void AddFallback(ElementContainer fallback) { if (IsFallbackDefined) { throw new BuildException("The <otherwise> element may only" + " be defined once.", Location); } _elementContainers.Add(fallback); }
/// <summary> /// Initializes a new instance of the <see cref="UserInterface"/> class. /// </summary> public UserInterface() { Container = new ElementContainer(); }