private void OnClickBuffIcon(GameObject go, bool pressed) { if (pressed) { UIButton btn = go.transform.GetComponent <UIButton>() as UIButton; if (btn.Data.GetType() == typeof(EBufferType)) { string tText2Show = string.Empty; EBufferType type = (EBufferType)btn.Data; switch (type) { case EBufferType.BUFFER_INSPIRE: tText2Show = string.Format(Globals.Instance.MDataTableManager.GetWordText(23600049), Globals.Instance.MPortVieManager.puVieDiamondInspire); break; case EBufferType.BUFFER_ORDER: tText2Show = string.Format(Globals.Instance.MDataTableManager.GetWordText(23600050), Globals.Instance.MPortVieManager.puVieDiamondOrder); break; } SetDescription(tText2Show); } else { BuffData data = btn.Data as BuffData; if (null == data) { return; } SetDescription(data.Descript); } } }
// BY LSJ // port vie or port defense inspire and order buffer void CreateBuffIcon(EBufferType type, int row, int col) { GameObject go = GameObject.Instantiate(BuffIconTp) as GameObject; go.name = type.ToString(); go.transform.parent = _mBuffInfoRoot; go.transform.localScale = Vector3.one; float x = (_mBuffIconWidth - -5) * col - 0.5f * _mBuffIconWidth; float y = -(_mBuffIconHeight + 5) * row - 0.5f * _mBuffIconHeight; go.transform.localPosition = new Vector3(x, y, -1f); UIButton btn = go.GetComponent <UIButton>() as UIButton; UIEventListener.Get(btn.gameObject).onPress += OnClickBuffIcon; btn.Data = type; PackedSprite icon = btn.transform.Find("Icon").GetComponent <PackedSprite>() as PackedSprite; string iconName = string.Empty; switch (type) { case EBufferType.BUFFER_INSPIRE: iconName = "Buf9901"; break; case EBufferType.BUFFER_ORDER: iconName = "Buf9801"; break; } icon.PlayAnim(iconName); }
public void GetData(FacePoint facepoint, List <IDataBuffer> buffers) { if (facepoint.BufferIndices == null) { return; } for (int i = 0; i < facepoint.BufferIndices.Count; ++i) { IDataBuffer b = buffers[i]; int index = facepoint.BufferIndices[i]; EBufferType type = b.Type; switch (type) { case EBufferType.Position: Position = (Vec3)b[index]; break; case EBufferType.Normal: Normal = (Vec3)b[index]; break; case EBufferType.Binormal: Binormal = (Vec3)b[index]; break; case EBufferType.Tangent: Tangent = (Vec3)b[index]; break; case EBufferType.Color: Color = (ColorF4)b[index]; break; case EBufferType.TexCoord: TexCoord = (Vec2)b[index]; break; } } }
public void SetData(FacePoint facepoint, List <IDataBuffer> buffers) { if (facepoint.BufferIndices == null) { return; } for (int i = 0; i < facepoint.BufferIndices.Count; ++i) { IDataBuffer b = buffers[i]; int index = facepoint.BufferIndices[i]; EBufferType type = b.Type; switch (type) { case EBufferType.Position: b[index] = Position; break; case EBufferType.Normal: b[index] = Normal; break; case EBufferType.Binormal: b[index] = Binormal; break; case EBufferType.Tangent: b[index] = Tangent; break; case EBufferType.Color: b[index] = Color; break; case EBufferType.TexCoord: b[index] = TexCoord; break; } } }
public IDataBuffer this[EBufferType type] { get => _buffers.FirstOrDefault(x => x.Type == type);