private static void RebuildUV(UIRenderData renderData, RenderOptions options) { Rect region = options.spriteInfo.region; PoolList <Vector2> uvs = renderData.uvs; uvs.Add(new Vector2(region.x, region.yMax)); uvs.Add(new Vector2(region.xMax, region.yMax)); uvs.Add(new Vector2(region.xMax, region.y)); uvs.Add(new Vector2(region.x, region.y)); Vector2 value = Vector2.zero; if (options.flip.IsFlagSet(UISpriteFlip.FlipHorizontal)) { value = uvs[1]; uvs[1] = uvs[0]; uvs[0] = value; value = uvs[3]; uvs[3] = uvs[2]; uvs[2] = value; } if (options.flip.IsFlagSet(UISpriteFlip.FlipVertical)) { value = uvs[0]; uvs[0] = uvs[3]; uvs[3] = value; value = uvs[1]; uvs[1] = uvs[2]; uvs[2] = value; } }
public override void ApplyBeforeConnections(Graph graph) { var layer = this.gameObject.layer; var bounds = this.bounds; bounds.center += this.transform.position; var nodes = PoolList <Node> .Spawn(10); graph.GetNodesInBounds(nodes, bounds); foreach (var node in nodes) { var ray = new Ray(node.worldPosition + Vector3.up * 10f, Vector3.down); if (Physics.Raycast(ray, out var hit, 1000f, this.layerMask) == true) { if (hit.collider.gameObject.layer == layer) { var dt = this.penaltyDelta; if (dt < 0) { node.penalty -= (uint)(-this.penaltyDelta); } else { node.penalty += (uint)this.penaltyDelta; } node.tag = this.tag; } } } PoolList <Node> .Recycle(ref nodes); }
private static void AddUVCoords(PoolList <Vector2> uvs, CharacterInfo glyph) { uvs.Add(glyph.uvTopLeft); uvs.Add(glyph.uvTopRight); uvs.Add(glyph.uvBottomRight); uvs.Add(glyph.uvBottomLeft); }
public void UpdateChance() { //Get GSM speed = gameStatManager.GetSpeed(); globalHashPower = gameStatManager.GetGlobalHashPower(); sharedReward = gameStatManager.GetSharedReward(); dailyElectricity = gameStatManager.GetDailyElectricity(); currentPool = gameStatManager.GetCurrentPool(); bitcoinPrice = gameStatManager.GetBitcoinValue(); if (currentPool == -1) { chance = speed / globalHashPower; } else { chance = (PoolList.GetPool(currentPool).hashrate + speed) / globalHashPower; } expectedEarning = (chance * sharedReward * bitcoinPrice) * 144 - (dailyElectricity * electricityManager.unitCost); //To GSM gameStatManager.SetChance(chance); gameStatManager.SetExpectedEarning(expectedEarning); }
/// <summary> /// Returns all events by tick range [from..to] (including from and to) /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> HistoryStorage IStatesHistoryModuleBase.GetHistoryStorage(Tick from, Tick to) { var list = PoolList <HistoryEvent> .Spawn(100); foreach (var data in this.events) { var tick = data.Key; if ((from != Tick.Invalid && tick < from) || (to != Tick.Invalid && tick > to)) { continue; } var values = data.Value.Values; for (int i = 0, cnt = values.Count; i < cnt; ++i) { var evt = values[i]; if (evt.storeInHistory == true) { list.Add(evt); } } } var storage = new HistoryStorage(); storage.events = list.ToArray(); PoolList <HistoryEvent> .Recycle(ref list); return(storage); }
static void CreatPoolList() { PoolList poolList = ScriptableObject.CreateInstance <PoolList>(); AssetDatabase.CreateAsset(poolList, "Assets/Framework/Resources/PoolList.asset"); AssetDatabase.SaveAssets(); }
public async Task <string> JoinPool(string poolName) { PoolList joinPool = new PoolList(); var pool = _context.Pools.FirstOrDefault(x => x.Name == poolName); if (pool == null) { return("Pool doesn't exist"); } var isEnrolled = _context.PoolList.Where(x => x.PoolId == pool.Id && x.UserId == _userManager.GetUserId(User)).Any(); if (isEnrolled) { return("You have already joined this pool!"); } joinPool.PoolId = pool.Id; joinPool.UserId = _userManager.GetUserId(User); await _context.PoolList.AddAsync(joinPool); await _context.SaveChangesAsync(); var poolTeams = _context.Teams.Where(x => x.PoolId == pool.Id); if (poolTeams.Count() >= pool.Size) { return("Pool is full!"); } return("Pool joined successfully!"); }
// Token: 0x06001451 RID: 5201 RVA: 0x00058EF8 File Offset: 0x000570F8 private static void RenderLine(PoolList <UIMarkupToken> m_Tokens, UIDynamicFont uidynamicFont, float textScale, Stack <ColorInfo> colors, Vector3 position, Texture2D outputTexture) { for (int i = 0; i < m_Tokens.Count; i++) { UIMarkupToken uimarkupToken = m_Tokens[i]; UIMarkupTokenType tokenType = uimarkupToken.tokenType; if (tokenType == UIMarkupTokenType.Text) { ColorInfo colorInfo = colors.Peek(); position.x = RenderText(uidynamicFont, uimarkupToken.value, position, textScale, colorInfo.color, default, outputTexture);
private static void RebuildColors(UIRenderData renderData, RenderOptions options) { Color32 item = options.color.linear; PoolList <Color32> colors = renderData.colors; for (int i = 0; i < 4; i++) { colors.Add(item); } }
private static void AddTriangleIndices(PoolList <Vector3> verts, PoolList <int> triangles) { int count = verts.Count; int[] array = kTriangleIndices; for (int i = 0; i < array.Length; i++) { triangles.Add(count + array[i]); } }
public void Recycle() { if (this.nodes != null) { PoolList <Node> .Recycle(ref this.nodes); } if (this.nodesModified != null) { PoolList <Node> .Recycle(ref this.nodesModified); } }
private static void RebuildTriangles(UIRenderData renderData, RenderOptions options) { int baseIndex = options.baseIndex; PoolList <int> triangles = renderData.triangles; triangles.EnsureCapacity(triangles.Count + kTriangleIndices.Length); for (int i = 0; i < kTriangleIndices.Length; i++) { triangles.Add(baseIndex + kTriangleIndices[i]); } }
/// <summary> /// メタデータを含むテキストデータを解析 /// </summary> /// <param name="text">解析するテキスト</param> protected virtual void Parse() { try { //テキストを先頭から1文字づつ解析 int max = OriginalText.Length; int index = 0; while (index < max) { if (ParseEscapeSequence(index)) { //エスケープシーケンスの処理 index += 2; } else { string tagName = ""; string tagArg = ""; int endIndex = ParserUtil.ParseTag(OriginalText, index, (name, arg) => { bool ret = ParseTag(name, arg); if (ret) { tagName = name; tagArg = arg; } return(ret); }); if (index == endIndex) { //タグがなかった //通常パターンのテキストを1文字追加 AddChar(OriginalText[index]); ++index; } else { //タグデータを挿入 string tagString = OriginalText.Substring(index, endIndex - index + 1); PoolList.Insert(0, MakeTag(tagString, tagName, tagArg)); index = endIndex + 1; } } ParsedDataList.AddRange(PoolList); PoolList.Clear(); } PoolList.Clear(); } catch (System.Exception e) { AddErrorMsg(e.Message + e.StackTrace); } }
private void ShowPoolData() { Pool pool = PoolList.GetPool(currentPool); yesPanel.transform.Find("MiningPoolName").GetComponent <Text>().text = pool.poolName; float totalHashrate = pool.hashrate + gameStatManager.GetSpeed(); yesPanel.transform.Find("MainPanel/ChanceValue").GetComponent <Text>().text = ((totalHashrate / gameStatManager.GetGlobalHashPower()) * 100).ToString("N2") + "%"; yesPanel.transform.Find("MainPanel/HashrateValue").GetComponent <Text>().text = (pool.hashrate + gameStatManager.GetSpeed()).ToString(); yesPanel.transform.Find("MainPanel/MemberValue").GetComponent <Text>().text = pool.member.ToString(); }
//私有构造,完成dict的赋值 private PoolManger() { PoolList poolList = Resources.Load <PoolList>("PoolList");//读取序列化文件 _poolDict = new Dictionary <string, GameObjectPool>(); foreach (var pool in poolList.poolList) { _poolDict.Add(pool.poolName, pool); } }
public override void OnRecycle() { this.isTag = default; PoolArray <TComponent> .Recycle(ref this.components); PoolArray <byte> .Recycle(ref this.componentsStates); if (this.lifetimeIndexes != null) { PoolList <int> .Recycle(ref this.lifetimeIndexes); } }
private void OnRecycle() { if (this.graphs != null) { for (int i = 0; i < this.graphs.Count; ++i) { this.graphs[i].Recycle(); } PoolList <Graph> .Recycle(ref this.graphs); } }
public DesktopPools(String ip, String userID, String userName, String pwd, PoolList pList, String domainName, string domainid) : this() { UserID = userID; UserName = userName; PList = pList.getPools(); userLabel.Content = userName; DomainName = domainName; poolListBox.ItemsSource = PList; domainID = domainid; ServerIP = ip; Password = pwd; }
private ListCopyable <Node> RetracePath(int threadIndex, Node endNode) { var path = PoolList <Node> .Spawn(10); path.Add(endNode); while (endNode.parent[threadIndex] != null) { endNode = endNode.parent[threadIndex]; path.Add(endNode); } path.Reverse(); return(path); }
public override void OnDeconstruct() { this.pool.Clear(); this.pool = null; if (this.currentTransformArray.isCreated == true) { this.currentTransformArray.Dispose(); } //if (this.resultTransforms != null) PoolList<UnityEngine.Transform>.Recycle(ref this.resultTransforms); if (this.tempList != null) { PoolList <MonoBehaviourView> .Recycle(ref this.tempList); } }
private void OnRecycle() { this.clonePathfinding = false; this.logLevel = default; if (this.graphs != null) { for (int i = 0; i < this.graphs.Count; ++i) { this.graphs[i].Recycle(); } PoolList <Graph> .Recycle(ref this.graphs); } }
public override void ApplyAfterConnections(Graph graph) { var nodes = PoolList <Node> .Spawn(10); var bounds = this.bounds; bounds.center += this.transform.position; graph.GetNodesInBounds(nodes, this.bounds); foreach (var node in nodes) { if (this.modifyWalkability == true) { node.walkable = this.walkable; } } }
GameObject CreateFromPrefab(GameObject Prefab, Vector3 spawnPosition, Quaternion spawnRotation) { for(int loop = 0; loop < m_PoolList.Count; loop++) { if(m_PoolList[loop].m_Prefab == Prefab) { return(m_PoolList[loop].AllocatedFromPool(spawnPosition, spawnRotation)); } } PoolList NewPoolList = new PoolList(Prefab); m_DebugPoolArray[m_PoolList.Count] = NewPoolList; m_PoolList.Add (NewPoolList); return(NewPoolList.AllocatedFromPool(spawnPosition, spawnRotation)); }
private void vehicleHover(UIComponent component, UIMouseEventParameter eventParam) { bool oldVal = component.GetComponentInChildren <DraggableVehicleInfo>().isDragging; bool newVal = (eventParam.buttons & UIMouseButton.Left) != UIMouseButton.None; component.GetComponentInChildren <DraggableVehicleInfo>().isDragging = newVal; if (oldVal != newVal && newVal == false) { TLMUtils.doLog("onVehicleDrop! {0}", component.name); DraggableVehicleInfo dvi = eventParam.source.parent.GetComponentInChildren <DraggableVehicleInfo>(); UIView view = GameObject.FindObjectOfType <UIView>(); PoolList <UIHitInfo> hits = view.RaycastAll(eventParam.ray); DroppableStationInfo dsi = null; UIComponent res = null; int idxRes = -1; for (int i = hits.Count - 1; i >= 0; i--) { UIHitInfo hit = hits[i]; DroppableStationInfo[] dsiList = hit.component.GetComponentsInChildren <DroppableStationInfo>(); if (dsiList.Length == 0) { dsiList = hit.component.parent.GetComponentsInChildren <DroppableStationInfo>(); } if (dsiList.Length == 1) { dsi = dsiList[0]; res = hit.component; idxRes = i; break; } } if (dvi == null || dsi == null) { TLMUtils.doLog("Drag Drop falhou! {0}", eventParam.source.name); return; } else { TLMUtils.doLog("Drag Funcionou! {0}/{1} ({2}-{3})", eventParam.source.name, dsi.gameObject.name, res.gameObject.name, idxRes); VehicleAI ai = (VehicleAI)Singleton <VehicleManager> .instance.m_vehicles.m_buffer[dvi.vehicleId].Info.GetAI(); ai.SetTarget(dvi.vehicleId, ref Singleton <VehicleManager> .instance.m_vehicles.m_buffer[dvi.vehicleId], dsi.nodeId); } } }
private void ShowPool() { foreach (Pool pool in PoolList.GetList()) { //Get pool data from GSM poolFrame.transform.Find("PoolName").GetComponent <Text>().text = pool.poolName; poolFrame.transform.Find("Member").GetComponent <Text>().text = pool.member.ToString(); poolFrame.transform.Find("Hashrate").GetComponent <Text>().text = pool.hashrate.ToString(); float chance = pool.hashrate / gameStatManager.GetGlobalHashPower(); poolFrame.transform.Find("Chance").GetComponent <Text>().text = (chance * 100).ToString("N2") + "%"; //Show pools GameObject poolItem = Instantiate(poolFrame, this.transform); //Get buttons poolItem.GetComponent <Button>().onClick.AddListener(() => OnPoolClick(pool)); } }
public void Add(IView view) { if (this.mainView == null) { this.mainView = view; } else { if (this.otherViews == null) { this.otherViews = PoolList <IView> .Spawn(1); } this.otherViews.Add(view); } this.isNotEmpty = true; }
public virtual bool IsSuitable(Constraint constraint) { if (constraint.checkWalkability == true && this.walkable != constraint.walkable) { return(false); } if (constraint.checkArea == true && (constraint.areaMask & (1 << this.area)) == 0) { return(false); } if (constraint.checkTags == true && (constraint.tagsMask & (1 << this.tag)) == 0) { return(false); } if (constraint.graphMask >= 0 && (constraint.graphMask & (1 << this.graph.index)) == 0) { return(false); } if (constraint.tagsMask > 0L && (constraint.agentSize.x > 0f || constraint.agentSize.y > 0f || constraint.agentSize.z > 0f)) { var result = PoolList <Node> .Spawn(10); this.graph.GetNodesInBounds(result, new Bounds(this.worldPosition, constraint.agentSize)); for (int e = 0, cnt = result.Count; e < cnt; ++e) { var node = result[e]; var constraintErosion = constraint; constraintErosion.agentSize = Vector3.zero; if (node.IsSuitable(constraintErosion) == false) { return(false); } } PoolList <Node> .Recycle(ref result); } return(true); }
private static Rect RebuildVertices(UIRenderData renderData, RenderOptions options) { PoolList <Vector3> vertices = renderData.vertices; int baseIndex = options.baseIndex; float x = 0f; float y = 0f; float x2 = Mathf.Ceil(options.size.x); float y2 = Mathf.Ceil(-options.size.y); vertices.Add(new Vector3(x, y, 0f) * options.pixelsToUnits); vertices.Add(new Vector3(x2, y, 0f) * options.pixelsToUnits); vertices.Add(new Vector3(x2, y2, 0f) * options.pixelsToUnits); vertices.Add(new Vector3(x, y2, 0f) * options.pixelsToUnits); Vector3 b = (options.offset * 10).RoundToInt() * options.pixelsToUnits / 10; for (int i = 0; i < 4; i++) { vertices[baseIndex + i] = (vertices[baseIndex + i] + b).Quantize(options.pixelsToUnits); } return(new Rect(vertices[0], vertices[2])); }
private static void DoFill(UIRenderData renderData, RenderOptions options) { int baseIndex = options.baseIndex; PoolList <Vector3> vertices = renderData.vertices; PoolList <Vector2> uvs = renderData.uvs; int index = baseIndex + 3; int index2 = baseIndex + 2; int index3 = baseIndex; int index4 = baseIndex + 1; if (options.invertFill) { if (options.fillDirection == UIFillDirection.Horizontal) { index = baseIndex + 1; index2 = baseIndex; index3 = baseIndex + 2; index4 = baseIndex + 3; } else { index = baseIndex; index2 = baseIndex + 1; index3 = baseIndex + 3; index4 = baseIndex + 2; } } if (options.fillDirection == UIFillDirection.Horizontal) { vertices[index2] = Vector3.Lerp(vertices[index2], vertices[index], 1f - options.fillAmount); vertices[index4] = Vector3.Lerp(vertices[index4], vertices[index3], 1f - options.fillAmount); uvs[index2] = Vector2.Lerp(uvs[index2], uvs[index], 1f - options.fillAmount); uvs[index4] = Vector2.Lerp(uvs[index4], uvs[index3], 1f - options.fillAmount); return; } vertices[index3] = Vector3.Lerp(vertices[index3], vertices[index], 1f - options.fillAmount); vertices[index4] = Vector3.Lerp(vertices[index4], vertices[index2], 1f - options.fillAmount); uvs[index3] = Vector2.Lerp(uvs[index3], uvs[index], 1f - options.fillAmount); uvs[index4] = Vector2.Lerp(uvs[index4], uvs[index2], 1f - options.fillAmount); }
public override void ApplyBeforeConnections(Graph graph) { var visited = PoolHashSet <Node> .Spawn(); foreach (var pos in this.bounds.allPositionsWithin) { var tile = this.tilemap.GetTile(pos); for (int i = 0; i < this.items.Length; ++i) { var item = this.items[i]; if (item.requiredTile == tile) { var worldPos = this.tilemap.CellToWorld(pos); var result = PoolList <Node> .Spawn(1); graph.GetNodesInBounds(result, new Bounds(worldPos + new Vector3(this.tilemap.cellSize.x, 0f, this.tilemap.cellSize.z) * 0.5f, this.tilemap.cellSize)); foreach (var node in result) { if (visited.Contains(node) == false) { visited.Add(node); var dt = item.penaltyDelta; if (dt < 0) { node.penalty -= (uint)(-item.penaltyDelta); } else { node.penalty += (uint)item.penaltyDelta; } node.tag = item.tag; } } PoolList <Node> .Recycle(ref result); } } } PoolHashSet <Node> .Recycle(ref visited); }
void IModuleBase.OnDeconstruct() { this.isRequestsDirty = true; this.UpdateRequests(); var temp = PoolList <IView> .Spawn(this.registryPrefabToId.Count); foreach (var prefab in this.registryIdToPrefab) { temp.Add(prefab.Value); } foreach (var prefab in temp) { this.UnRegisterViewSource(prefab); } PoolList <IView> .Recycle(ref temp); PoolDictionary <ViewId, IViewsProvider> .Recycle(ref this.registryPrefabToProvider); PoolDictionary <ViewId, IViewsProviderInitializerBase> .Recycle(ref this.registryPrefabToProviderInitializer); PoolDictionary <ViewId, IView> .Recycle(ref this.registryIdToPrefab); PoolDictionary <IView, ViewId> .Recycle(ref this.registryPrefabToId); PoolHashSet <ViewInfo> .Recycle(ref this.rendering); for (int i = 0; i < this.list.Length; ++i) { var views = this.list.arr[i]; if (views.otherViews != null) { PoolList <IView> .Recycle(views.otherViews); } } //PoolDictionary<int, List<IView<TEntity>>>.Recycle(ref this.list); PoolArray <Views> .Recycle(ref this.list); }
private void AddGroup(PoolList<GroupInfo> groupItems, PrefabInfo info) { throw new NotImplementedException("AddGroup is target of redirection and is not implemented."); }
internal static PoolObject Create(GameObject Prefab, PoolList Creator, Vector3 spawnPosition, Quaternion spawnRotation) { PoolObject NewPoolObject = new PoolObject(); NewPoolObject.m_Next = null; NewPoolObject.m_GameObject = GameObject.Instantiate(Prefab) as GameObject; NewPoolObject.m_GameObject.transform.parent = Creator.m_Container.transform; NewPoolObject.m_GameObject.transform.position = spawnPosition; NewPoolObject.m_GameObject.transform.rotation = spawnRotation; return(NewPoolObject); }
internal void Reuse(PoolList Creator, Vector3 spawnPosition, Quaternion spawnRotation) { m_GameObject.transform.parent = Creator.m_Container.transform; m_GameObject.transform.position = spawnPosition; m_GameObject.transform.rotation = spawnRotation; }