public quad(index Position, Vector3[] Vertices, Vector2[] UVs, int[] Lookup) { position = Position; vertices = Vertices; uvs = UVs; lookup = Lookup; }
void Update() { if (Input.GetButtonDown("Fire1")) { if ((Input.mousePosition.x > lowerLeft.x) && (Input.mousePosition.y > lowerLeft.y) && (Input.mousePosition.x < upperRight.x) && (Input.mousePosition.y < upperRight.y)) { index mousePosition = new index(Mathf.FloorToInt(((Input.mousePosition.x - lowerLeft.x)/(upperRight.x - lowerLeft.x)) * width), Mathf.FloorToInt(((Input.mousePosition.y - lowerLeft.y)/(upperRight.y-lowerLeft.y)) * height)); editUV(mousePosition, new Vector2[4] { new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 0), new Vector2(1, 1)}); } else { RaycastHit hit; if (Physics.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition), out hit)) { if (hit.collider.name == tileSetSelector.name) { int localWidth = tileSetSelector.gameObject.GetComponent<MeshRenderer>().material.mainTexture.width/TileSize; debugVar = Mathf. (hit.textureCoord); } } } } }
string GetLine(index) { if(index >= lines.Length) return null; return lines[index].Trim(' '); }
public int[] lookup(index position) { int[] arrayPosition = new int[4]; arrayPosition[0] = ((position.y * width + position.x) * 4); arrayPosition[1] = ((position.y * width + position.x) * 4 + 1); arrayPosition[2] = ((position.y * width + position.x) * 4 + 2); arrayPosition[3] = ((position.y * width + position.x) * 4 + 3); return arrayPosition; }
void editUV(index location, Vector2[] newUVs) { int[] activeSpace = math.lookup(location); Vector2[] tempUVs = screen.uv; for (int i = 0; i < activeSpace.Length; i++) { tempUVs[activeSpace[i]] = newUVs[i]; } screen.uv = tempUVs; graphics.mesh = screen; }
=> index is ItemIndexExpression itemIndex && !itemIndex.IsFromEnd ? itemIndex.Value : Call(index, nameof(Index.GetOffset), null, count);
DrawHeaderEvent(index, evt);
set => Set(index, value);
set { Set(index, value); }
set => SetCache(index, value);
set => SetItem(index, value);
set => SetValue(index, value);
set => SetParameter(index, value);
Replace(index, value);
set => this.SetByIndex(index, value);
set => ReplaceAt(index, value);
set => WriteMemory(index, value);
get => GetElement(index); set => SetElement(index, value);
set => Insert(index, value);
get => Get(index, frame);
? map.TileSheets.Select((sheet, index) => new TilesheetReference(index, sheet.Id, sheet.ImageSource)).ToArray()
set => Set(index, value, frame);
CheckIndex(index, length);
set => this.Set(index, value);
CheckIndex0(index, src.Length);
set => setIndex(index, value, null);
var(index, name, args) = call;
Insert(index, value);
_ = Unwrap().SetBytes(index, src); return(this);
/// <summary> /// 开始读取文件 /// </summary> public unsafe void Read() { do { int readSize = index.Size + sizeof(int); try { if (FileStream.isDisposed == 0) { buffer = (memoryPool = memoryPool.GetPool(readSize)).Get(); FileStream fileReader = FileStream.fileReader; long offset = fileReader.Position - index.Index; if (offset >= 0 || -offset < index.Index) fileReader.Seek(offset, SeekOrigin.Current); else fileReader.Seek(index.Index, SeekOrigin.Begin); if (fileReader.Read(buffer, 0, readSize) == readSize) { fixed (byte* bufferFixed = buffer) { if (*(int*)bufferFixed == index.Size) readSize = index.Size; else log.Default.Add(FileStream.FileName + " index[" + index.Index.toString() + "] size[" + (*(int*)bufferFixed).toString() + "]<>" + index.Size.toString(), false, false); } } else readSize = 0; } } catch (Exception error) { log.Default.Add(error, null, false); } Func<fastCSharp.code.cSharp.asynchronousMethod.returnValue<fastCSharp.code.cSharp.tcpBase.subByteArrayEvent>, bool> onReaded = this.onReaded; if (readSize == index.Size) { if (onReaded(new fastCSharp.code.cSharp.tcpBase.subByteArrayEvent { Buffer = subArray<byte>.Unsafe(buffer, sizeof(int), index.Size), Event = memoryPool.PushSubArray })) buffer = null; else memoryPool.Push(ref buffer); } else { onReaded(default(fastCSharp.code.cSharp.tcpBase.subByteArrayEvent)); if (memoryPool != null) memoryPool.Push(ref buffer); } reader next = FileStream.next(this); if (next == null) { FileStream = null; onReaded = null; memoryPool = null; typePool<reader>.Push(this); return; } onReaded = next.onReaded; index = next.index; next.onReaded = null; typePool<reader>.Push(next); } while (true); }
public IByteBuffer SetBytes(int index, in ReadOnlySpan <byte> src) => CheckIndex(index, src.Length);
public virtual void visit(index _index) { DefaultVisit(_index); }
set => Add(index, value);
set => SetField(index, value);
/// <summary> /// 文件读取 /// </summary> /// <param name="index">读取文件位置</param> /// <param name="onReaded">读取文件回调函数</param> /// <returns></returns> public static reader Get(index index, Func<fastCSharp.code.cSharp.asynchronousMethod.returnValue<fastCSharp.code.cSharp.tcpBase.subByteArrayEvent>, bool> onReaded) { reader reader = typePool<reader>.Pop(); if (reader == null) { try { reader = new reader(); } catch { return null; } } reader.onReaded = onReaded; reader.index = index; return reader; }
set => Modify(new ItemIndexPair(index, value), ((currentArray, pair) =>
/// <summary> /// 读取文件分块数据//showjim+cache /// </summary> /// <param name="index">文件分块数据位置</param> /// <param name="size">文件分块字节大小</param> /// <param name="onReaded"></param> internal unsafe void Read(index index, Func<fastCSharp.code.cSharp.asynchronousMethod.returnValue<fastCSharp.code.cSharp.tcpBase.subByteArrayEvent>, bool> onReaded) { if (onReaded == null) log.Error.Throw(log.exceptionType.Null); long endIndex = index.EndIndex; if (index.Size > 0 && ((int)index.Index & 3) == 0 && endIndex <= fileBufferLength) { if (endIndex <= fileLength) { reader reader = reader.Get(index, onReaded); if (reader != null) { if (set(reader)) fastCSharp.threading.threadPool.TinyPool.FastStart(reader.ReadHandle, null, null); return; } } else { memoryPool memoryPool = null; byte[] buffer = null; int copyedSize = int.MinValue; interlocked.NoCheckCompareSetSleep0(ref bufferLock); if (isDisposed == 0) { if (index.Index >= bufferIndex) { index.Index -= bufferIndex; try { buffer = (memoryPool = memoryPool.GetPool(index.Size)).Get(index.Size); foreach (memoryPool.pushSubArray nextData in buffers.array) { subArray<byte> data = nextData.SubArray; if (index.Index != 0) { if (index.Index >= data.Count) { index.Index -= data.Count; continue; } data.UnsafeSet(data.StartIndex + (int)index.Index, data.Count - (int)index.Index); index.Index = 0; } if (copyedSize < 0) { fixed (byte* dataFixed = data.array) { if (*(int*)(dataFixed + data.StartIndex) != index.Size) break; } if ((copyedSize = data.Count - sizeof(int)) == 0) continue; data.UnsafeSet(data.StartIndex + sizeof(int), copyedSize); copyedSize = 0; } int copySize = index.Size - copyedSize; if (data.Count >= copySize) { Buffer.BlockCopy(data.array, data.StartIndex, buffer, copyedSize, copySize); copyedSize = index.Size; break; } Buffer.BlockCopy(data.array, data.StartIndex, buffer, copyedSize, copySize); copyedSize += copySize; } } catch (Exception error) { log.Default.Add(error, null, false); } finally { bufferLock = 0; } if (copyedSize == index.Size) { onReaded(new fastCSharp.code.cSharp.tcpBase.subByteArrayEvent { Buffer = subArray<byte>.Unsafe(buffer, 0, index.Size), Event = memoryPool.PushSubArray }); return; } } else { bufferLock = 0; reader reader = reader.Get(index, onReaded); if (reader != null) { fastCSharp.threading.threadPool.TinyPool.FastStart(waitHandle, reader, null, null); return; } } } else bufferLock = 0; } } onReaded(default(fastCSharp.code.cSharp.tcpBase.subByteArrayEvent)); }
set => SetItemImpl(index, value);