public BaseObject IPGet(object target) { ObjectID oid; if (target is int) { oid = new ObjectID((uint)(int)target); } else if (target is string) { if (ObjectID.TryParse((string)target, out oid) == false) return null; } else { return null; } var ob = FindObject(oid); if (ob == null) throw new Exception(String.Format("object {0} not found", target)); return ob; }
// Use this for initialization void Start() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; lookingAt = null; activeObj = null; }
public static Image getImageForListBox(BitmapImage bmpImage, ObjectID id, int width, int height) { Image image = new Image(); image.Tag = (int)id; image.Source = bmpImage; image.Width = width; image.Height = height; return image; }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, cursor); RequestID = new ObjectID(Buffer, cursor); cursor += RequestID.ByteLength; return cursor - StartIndex; }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, StartIndex); NewEquippedItem = new ObjectID(Buffer, cursor); cursor += NewEquippedItem.ByteLength; return cursor - StartIndex; }
// Update is called once per frame void FixedUpdate() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1 << LayerMask.NameToLayer("CanClick"))) { lookingAt = (ObjectID) hit.transform.gameObject.GetComponent("ObjectID"); activeObj = (lookingAt == null) ? null : hit.transform; } else { lookingAt = null; activeObj = null; } }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, cursor); Item = new ObjectID(Buffer, cursor); cursor += Item.ByteLength; Target = new ObjectID(Buffer, cursor); cursor += Target.ByteLength; return cursor - StartIndex; }
string GetPrintableLivingName(ObjectID objectID) { if (objectID == ObjectID.NullObjectID) { return "nobody"; } else { var ob = m_world.FindObject(objectID); if (ob == null) return "somebody"; else return ob.ToString(); } }
public override int ReadFrom(byte[] Buffer, int StartIndex=0) { int cursor = StartIndex; if ((UserCommandType)Buffer[cursor] != CommandType) throw new Exception(ERRORWRONGTYPEBYTE); else { cursor++; // Type (1 byte) GuildID = new ObjectID(Buffer, cursor); // GuildID (4/8 bytes) cursor += GuildID.ByteLength; } return cursor - StartIndex; }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, cursor); Target = new ObjectID(Buffer, cursor); cursor += Target.ByteLength; ushort len = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; ObjectDescription = Encoding.Default.GetString(Buffer, cursor, len); cursor += len; return cursor - StartIndex; }
public EnvironmentObject(World world, ObjectID objectID) : base(world, objectID) { this.Version = 1; m_tileGrid = new GrowingTileGrid(); m_objectMap = new Dictionary<IntPoint3, List<MovableObject>>(); m_areaElements = new ObservableCollection<IAreaElement>(); this.AreaElements = new ReadOnlyObservableCollection<IAreaElement>(m_areaElements); this.ItemTracker = new ItemTracker(this); this.Designations = new Designation(this); this.InstallItemManager = new InstallItemManager(this); this.ConstructManager = new ConstructManager(this); }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, StartIndex); ushort len = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; EquippedObjects = new ObjectID[len]; for (int i = 0; i < len; i++) { EquippedObjects[i] = new ObjectID(Buffer, cursor); cursor += EquippedObjects[i].ByteLength; } return cursor - StartIndex; }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, cursor); Holder = new ObjectID(Buffer, cursor); cursor += Holder.ByteLength; ushort len = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; DepositItems = new ObjectID[len]; for (int i = 0; i < len; i++) { DepositItems[i] = new ObjectID(Buffer, cursor); cursor += DepositItems[i].ByteLength; } return cursor - StartIndex; }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, cursor); ObjectID = new ObjectID(Buffer, cursor); cursor += ObjectID.ByteLength; ushort len = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; ContentObjects = new ObjectBase[len]; for (int i = 0; i < len; i++) { ContentObjects[i] = new ObjectBase(true, Buffer, cursor); cursor += ContentObjects[i].ByteLength; } return cursor - StartIndex; }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, StartIndex); ushort len = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; RecipientsIDs = new ObjectID[len]; for (int i = 0; i < len; i++) { RecipientsIDs[i] = new ObjectID(Buffer, cursor); cursor += RecipientsIDs[i].ByteLength; } len = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; Text = Encoding.Default.GetString(Buffer, cursor, len); cursor += len; return cursor - StartIndex; }
public static odfTexture CreateTexture(ImportedTexture impTex, ObjectID id, int format, string odfPath) { odfTexture odfTex = new odfTexture(new ObjectName(impTex.Name, null), id, format); odfTex.TextureFile = new ObjectName(impTex.Name, null); string destPath = odfPath + @"\" + odfTex.TextureFile; DirectoryInfo dir = new DirectoryInfo(odfPath); if (!dir.Exists) { dir.Create(); } if (File.Exists(destPath)) { string backup = Utility.GetDestFile(dir, Path.GetFileNameWithoutExtension(destPath) + ".bak", Path.GetExtension(odfTex.TextureFile)); File.Move(destPath, backup); } odf.ImportTexture(impTex, destPath); return odfTex; }
public static odfBoneList CreateBoneList(ObjectID id, ObjectID meshFrameId, odfSubmesh submesh, List<ImportedBone> boneList, Matrix lMeshMatrixInv, odfFrame rootFrame) { if (boneList == null || boneList.Count == 0) return null; Dictionary<byte, Tuple<byte, odfBone>> boneDic = new Dictionary<byte, Tuple<byte, odfBone>>(boneList.Count); Tuple<List<int>, List<float>>[] newBoneListComponents = new Tuple<List<int>, List<float>>[boneList.Count]; int boneframeNotFound = 0; for (int i = 0; i < submesh.NumVertices; i++) { odfVertex vert = submesh.VertexList[i]; for (int j = 0; j < vert.BoneIndices.Length; j++) { byte boneIdx = vert.BoneIndices[j]; if (boneIdx == 0xFF) continue; Tuple<byte, odfBone> boneDesc; odfBone newBone; if (!boneDic.TryGetValue(boneIdx, out boneDesc)) { odfFrame boneFrame = odf.FindFrame(boneList[boneIdx].Name, rootFrame); if (boneFrame == null) { boneframeNotFound++; continue; } newBone = new odfBone(boneFrame.Id); newBone.Matrix = boneList[boneIdx].Matrix; boneDesc = new Tuple<byte, odfBone>((byte)boneDic.Count, newBone); boneDic.Add(boneIdx, boneDesc); newBoneListComponents[boneDesc.Item1] = new Tuple<List<int>, List<float>>(new List<int>(200), new List<float>(200)); } else newBone = boneDesc.Item2; byte newBoneIdx = boneDesc.Item1; List<int> newBoneIdxList = newBoneListComponents[newBoneIdx].Item1; newBoneIdxList.Add(i); List<float> newBoneWeightList = newBoneListComponents[newBoneIdx].Item2; newBoneWeightList.Add(vert.Weights[j]); } } if (boneDic.Count == 0) { Report.ReportLog(submesh.ToString() + ": all bones dropped because of missing skeleton."); return null; } odfBoneList newBoneList = new odfBoneList(new ObjectName(String.Empty, null), id, boneDic.Count); newBoneList.MeshFrameId = meshFrameId; newBoneList.SubmeshId = submesh.Id; newBoneList.AlwaysZero4 = new byte[4]; foreach (Tuple<byte, odfBone> boneDesc in boneDic.Values) { byte newBoneIdx = boneDesc.Item1; List<int> newBoneIdxList = newBoneListComponents[newBoneIdx].Item1; List<float> newBoneWeightList = newBoneListComponents[newBoneIdx].Item2; odfBone newBone = boneDesc.Item2; newBone.AlwaysZero24perIndex = new byte[24 * newBoneIdxList.Count]; newBone.VertexIndexArray = newBoneIdxList.ToArray(); newBone.WeightArray = newBoneWeightList.ToArray(); Matrix lMatrix = Matrix.Invert(newBone.Matrix); newBone.Matrix = Matrix.Invert(lMatrix * lMeshMatrixInv); newBoneList.AddChild(newBone); } if (boneframeNotFound > 0) Report.ReportLog(submesh.ToString() + ": " + boneframeNotFound + " bone(s) because of missing boneframe(s) dropped."); return newBoneList; }
private void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Armario") { if (hiden) { stats.state = PlayerStats.States.HIDEN; } if (Input.GetKeyDown(KeyCode.F)) { anim = GetComponent <Animator>(); Debug.Log("f"); if (!hiden) { anim.ResetTrigger("Salir"); anim.SetTrigger("Esconderse"); if (controller.numeroObjetivo == 12) { controller.numeroObjetivo++; } } else if (hiden) { anim.ResetTrigger("Esconderse"); anim.SetTrigger("Salir"); } hiden = !hiden; } } if (other.gameObject.tag == "CajaFuerte") { if (Input.GetKey(KeyCode.F)) { ID = other.gameObject.GetComponent <ObjectID>(); stats.stealing = true; if (ID.ID == 50) { if (inventory.FindItemInInventory(3) != null) { if (!ID.canOpen) { ID.canOpen = true; } } } if (ID.ID == 45) { if (inventory.FindItemInInventory(6) != null) { if (!ID.canOpen) { //stats.stealing = true; ID.canOpen = true; } } } } } if (other.gameObject.tag == "Alarma") { Alarm alarm; if (Input.GetKey(KeyCode.F)) { alarm = other.gameObject.GetComponent <Alarm>(); alarm.setOn(); // alarm.hack(); } } }
public StateType GetState(ObjectID objectID) { return(SafeInnerDataManager.GetState(objectID)); }
public int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; overlayFileRID = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; colorTranslation = Buffer[cursor]; cursor++; } else if (((AnimationType)Buffer[cursor] == AnimationType.EFFECT)) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; effect = Buffer[cursor]; cursor++; } animation = Animation.ExtractAnimation(Buffer, cursor); animation.PropertyChanged += animation_PropertyChanged; cursor += animation.ByteLength; source = new ObjectID(Buffer, cursor); cursor += source.ByteLength; target = new ObjectID(Buffer, cursor); cursor += target.ByteLength; speed = Buffer[cursor]; cursor++; flags = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; lightFlags = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; if (lightFlags > 0) { lightIntensity = Buffer[cursor]; cursor++; lightColor = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; } return cursor - StartIndex; }
public DataContainer GetDataContainerWithoutLoading(ObjectID objectID) { return(SafeInnerDataManager.GetDataContainerWithoutLoading(objectID)); }
public ObjectID GetViewObj(ObjectID item_ident) { return(m_Objects.GetObjectID(item_ident)); }
public UserCommandGuildEndEnemy(ObjectID GuildID) { this.GuildID = GuildID; }
public bool ChangeViewObj(ObjectID old_item_ident, ObjectID new_item_ident) { return(m_Objects.Change(old_item_ident, new_item_ident)); }
public IGameViewObj GetViewObjByIdent(ObjectID item_ident) { return((IGameViewObj)m_Objects.GetObjectByIdent(item_ident)); }
public bool RemoveViewObj(ObjectID item_ident) { return(m_Objects.Remove(item_ident)); }
private LoadedObjectDataWithDataSourceData CreateFetchedComputerData(Computer fetchedObject, ObjectID EmployeeID) { var endPointID = RelationEndPointObjectMother.CreateRelationEndPointID(fetchedObject.ID, "Employee"); var loadedObjectDataStub = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(fetchedObject); var dataContainer = RelationEndPointTestHelper.CreateExistingForeignKeyDataContainer(endPointID, EmployeeID); return(new LoadedObjectDataWithDataSourceData(loadedObjectDataStub, dataContainer)); }
public override IEnumerable <DataContainer> LoadDataContainersByRelatedID(RelationEndPointDefinition relationEndPointDefinition, SortExpressionDefinition sortExpressionDefinition, ObjectID relatedID) { throw new NotImplementedException(); }
public ContainerObject(World world, ObjectID objectID) : base(world, objectID) { m_contents = new MovableObjectCollection(); this.Contents = new ReadOnlyMovableObjectCollection(m_contents); }
//Owner //Health //Attack mode //[State] //Targeting and info //Idle //Stuck private void Start() { aiDroneCtrl = transform.parent.GetComponent <AIDroneController>(); objID = transform.parent.GetComponent <ObjectID>(); visualActive = false; }
public UserCommandGuildVote(ObjectID ID) { this.ID = ID; }
public Unit(ObjectID id, ObjectTypeID typeId) : this(id, typeId, (ushort)UnitFields.END) { }
public Projectile( uint ResourceID, AnimationType FirstObjectAnimationType, byte ColorTranslation, byte Effect, Animation Animation, ObjectID Source, ObjectID Targe, byte Speed, ushort Flags, ushort LightFlags, byte LightIntensity, ushort LightColor) { ID = nextID; nextID++; this.overlayFileRID = ResourceID; this.firstAnimationType = FirstObjectAnimationType; this.colorTranslation = ColorTranslation; this.effect = Effect; this.animation = Animation; this.source = Source; this.target = Target; this.flags = Flags; this.lightFlags = LightFlags; this.lightIntensity = LightIntensity; this.lightColor = LightColor; }
public void BuildInsertOrUpdateMetadata(ObjectID instance, IDbCommand insertCommand) { }
public override ObjectLookupResult <DataContainer> LoadDataContainer(ObjectID id) { return(new ObjectLookupResult <DataContainer> (id, LoadDataContainerResult)); }
protected BaseObject(World world, ObjectID objectID) { this.ObjectID = objectID; this.World = world; this.ClientCreationTime = DateTime.Now; }
private string GetObjectIDString(ObjectID id) { return(id != null?id.ToString() : "<null>"); }
public Character GetCharacterByID(IWhisperDatasource wshard, ObjectID characterId) { if (characterId.ObjectType != ObjectID.Type.Player) { throw new ArgumentException("GetCharacterByID called on ObjectID that is not a Player", "characterId"); } log.InfoFormat("loading character {0}", characterId); IList <ActionButton> actionButtons = new List <ActionButton>(); wshard.ExecuteQuery("select action, type from character_action_button where character_id = ? order by button asc", characterId.ID, result => { while (result.Read()) { actionButtons.Add(new ActionButton(result.GetInt32(0), (ActionButton.Type)result.GetByte(1))); } }); IList <Character.Spell> spells = new List <Character.Spell>(); wshard.ExecuteQuery("select spell_id, enabled from character_spell where character_id = ?", characterId.ID, result => { while (result.Read()) { spells.Add(new Character.Spell() { SpellID = result.GetInt32(0), Enabled = result.GetBoolean(1) }); } }); // TODO: player_fields // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 return(wshard.ExecuteQuery("select name, race, class, sex, skin, face, hair_style, hair_color, facial_hair, level, position_x, position_y, position_z, orientation, map_id, zone_id, player_flags, fields from `character` where id = ?", characterId.ID, result => { if (result.Read()) { Character character = new Character(characterId, result.GetString(0), actionButtons, spells); // set fields first. following updates could clobber information in that array if (result.IsDBNull(17)) { // new characters don't have field arrays yet character.FirstLogin = true; } else { int size = character.FieldCount * sizeof(uint); byte[] buffer = new byte[size]; long fieldsResult = result.GetBytes(17, 0, buffer, 0, size); if (fieldsResult == size) { character.SetRawFields(buffer); } else { // did not read the correct amount of bytes. corruption? throw new InvalidDataException($"character.fields had incorrect number of bytes. expected {size}, but got {fieldsResult}"); } } character.Position = new OrientedVector3(result.GetFloat(10), result.GetFloat(11), result.GetFloat(12), result.GetFloat(13)); character.MapID = result.GetInt32(14); character.ZoneID = result.GetInt32(15); Race raceEnum; if (Enum.TryParse(result.GetByte(1).ToString(), out raceEnum)) { character.Race = raceEnum; } else { throw new ArgumentException($"cannot load character with invalid race {result.GetByte(1)}"); } Class classEnum; if (Enum.TryParse(result.GetByte(2).ToString(), out classEnum)) { character.Class = classEnum; } else { throw new ArgumentException($"cannot load character with invalid class {result.GetByte(2)}"); } Sex sexEnum; if (Enum.TryParse(result.GetByte(3).ToString(), out sexEnum)) { character.Sex = sexEnum; } else { throw new ArgumentException($"cannot load character with invalid sex {result.GetByte(3)}"); } character.Skin = result.GetByte(4); character.Face = result.GetByte(5); character.HairStyle = result.GetByte(6); character.HairColor = result.GetByte(7); character.FaceExtra = result.GetByte(8); character.Level = result.GetByte(9); return character; } else { throw new ArgumentException("GetCharacterByID called on ObjectID that does not exist", nameof(characterId)); } })); }
public bool RecvRecordGrid(ref GameRecord rec, int isViewObj, int nIdent, int nSerial, int index, ref LoadArchive loadAr, int count) { try { Var key = new Var(); for (int i = 0; i < count; i++) { int row = 0; int col = 0; if (!loadAr.ReadInt16(ref row)) { return(false); } if (!loadAr.ReadInt8(ref col)) { return(false); } if (col >= mRecordTable[index].nCols) { //Log.Trace("col error"); return(false); } switch (mRecordTable[index].ColTypes[col]) { case OuterDataType.OUTER_TYPE_BYTE: { int value = 0; if (!loadAr.ReadInt8(ref value)) { return(false); } key.SetInt(value); } break; case OuterDataType.OUTER_TYPE_WORD: { int value = 0; if (!loadAr.ReadInt16(ref value)) { return(false); } key.SetInt(value); } break; case OuterDataType.OUTER_TYPE_DWORD: { int value = 0; if (!loadAr.ReadInt32(ref value)) { return(false); } key.SetInt(value); } break; case OuterDataType.OUTER_TYPE_QWORD: { long value = 0; if (!loadAr.ReadInt64(ref value)) { return(false); } key.SetInt64(value); } break; case OuterDataType.OUTER_TYPE_FLOAT: { float value = 0.0f; if (!loadAr.ReadFloat(ref value)) { return(false); } key.SetFloat(value); } break; case OuterDataType.OUTER_TYPE_DOUBLE: { double value = 0.0; if (!loadAr.ReadDouble(ref value)) { return(false); } key.SetDouble(value); } break; case OuterDataType.OUTER_TYPE_STRING: { string value = ""; if (!loadAr.ReadString(ref value)) { return(false); } key.SetString(value); } break; case OuterDataType.OUTER_TYPE_WIDESTR: { string value = ""; if (!loadAr.ReadWideStr(ref value)) { return(false); } key.SetWideStr(value); } break; case OuterDataType.OUTER_TYPE_OBJECT: { ObjectID value = new ObjectID(); if (!loadAr.ReadObject(ref value)) { return(false); } key.SetObject(value); } break; default: //Log.Trace("unknown type record name " + rec.GetName()); return(false); }//end switch if (!rec.SetValue(row, col, key)) { //Log.Trace("set value error recname " + rec.GetName()); return(false); } if (isViewObj == 0) { string ident = nIdent.ToString() + "-" + nSerial.ToString(); VarList argList = new VarList(); argList.AddString(ident); argList.AddString(rec.GetName()); argList.AddInt(row); argList.AddInt(col); if (!Excute_CallBack("on_record_single_grid", argList)) { //Log.Trace("does not RegistCallBack on_record_single_grid"); } }//end if (isViewObj == 0) else if (isViewObj == 3) { string view_ident = nIdent.ToString(); VarList argList = new VarList(); argList.AddString(view_ident); argList.AddString(rec.GetName()); argList.AddInt(row); argList.AddInt(col); if (!Excute_CallBack("on_view_record_single_grid", argList)) { //Log.Trace("does not RegistCallBack on_view_record_single_grid"); } }//end if (isViewObj == 3) else if (isViewObj == 1) { string view_ident = nIdent.ToString(); string item_ident = nSerial.ToString(); VarList argList = new VarList(); argList.AddString(view_ident); argList.AddString(item_ident); argList.AddString(rec.GetName()); argList.AddInt(row); argList.AddInt(col); if (!Excute_CallBack("on_viewobj_record_single_grid", argList)) { //Log.Trace("does not RegistCallBack on_viewobj_record_single_grid"); } }//end if (isViewObj == 1) else if (isViewObj == 2) { VarList argList = new VarList(); argList.AddString(rec.GetName()); argList.AddInt(row); argList.AddInt(col); if (!Excute_CallBack("on_scene_record_single_grid", argList)) { //Log.Trace("does not RegistCallBack on_scene_record_single_grid"); } } //end if (isViewObj == 2) } // end for (int i = 0; i < count; i ++ ) } catch (System.Exception ex) { Log.TraceExcep(ref ex); return(false); } return(true); }
/// <summary> /// Resurrects the invalid <see cref="DomainObject"/> with the given <paramref name="objectID"/> in the hierarchy of the given /// <paramref name="clientTransaction"/>, returning a value indicating if the resurrection was successful. /// </summary> /// <param name="clientTransaction">A <see cref="ClientTransaction"/> identifying the hierarchy in which to resurrect the object. The object /// is resurrected in all transactions of the hierarchy.</param> /// <param name="objectID">The <see cref="ObjectID"/> of the object to resurrect.</param> /// <returns><see langword="true" /> if the resurrection succeeded, <see langword="false" /> otherwise. Resurrection does not succeed if /// the <see cref="DomainObject"/> identified by <paramref name="objectID"/> is not invalid in at /// least one <see cref="ClientTransaction"/> of the transaction hierarchy identified by <paramref name="clientTransaction"/>. /// </returns> public static bool TryResurrectInvalidObject(ClientTransaction clientTransaction, ObjectID objectID) { ArgumentUtility.CheckNotNull("clientTransaction", clientTransaction); ArgumentUtility.CheckNotNull("objectID", objectID); var executor = new TransactionHierarchyCommandExecutor(tx => CreateMarkNotInvalidCommand(tx, objectID)); return(executor.TryExecuteCommandForTransactionHierarchy(clientTransaction)); }
public static odfMaterial CreateMaterial(ImportedMaterial impMat, ObjectID id) { odfMaterial odfMat = new odfMaterial(new ObjectName(impMat.Name, null), id); odfMat.Diffuse = impMat.Diffuse; odfMat.Ambient = impMat.Ambient; odfMat.Specular = impMat.Specular; odfMat.Emissive = impMat.Emissive; odfMat.SpecularPower = impMat.Power; return odfMat; }
private static IDataManagementCommand CreateMarkNotInvalidCommand(ClientTransaction tx, ObjectID objectID) { if (!tx.IsInvalid(objectID)) { var message = string.Format( "Cannot resurrect object '{0}' because it is not invalid within the whole transaction hierarchy. In transaction '{1}', the object has " + "state '{2}'.", objectID, tx, tx.GetObjectReference(objectID).TransactionContext[tx].State); var exception = new InvalidOperationException(message); return(new ExceptionCommand(exception)); } return(new MarkNotInvalidCommand(tx.DataManager, objectID)); }
public static void ReplaceMesh(odfFrame frame, odfParser parser, WorkspaceMesh mesh, List<ImportedMaterial> materials, List<ImportedTexture> textures, bool merge, CopyMeshMethod normalsMethod, CopyMeshMethod bonesMethod) { Matrix transform = Matrix.Identity; odfFrame transformFrame = frame; while (transformFrame != null) { transform *= transformFrame.Matrix; transformFrame = transformFrame.Parent as odfFrame; } transform.Invert(); string[] materialNames; int[] indices; bool[] worldCoords; bool[] replaceSubmeshesOption; odfMesh newMesh = CreateMesh(mesh, parser.MeshSection._FormatType, out materialNames, out indices, out worldCoords, out replaceSubmeshesOption); odfMesh frameMesh = odf.FindMeshListSome(frame.MeshId, parser.MeshSection); if (frameMesh != null) { if (parser.UsedIDs == null) // prevent misleading error message { parser.CollectObjectIDs(); } newMesh.Id = frameMesh.Id; newMesh.Name = frameMesh.Name; parser.MeshSection.InsertChild(parser.MeshSection.IndexOf(frameMesh), newMesh); } else { newMesh.Id = parser.GetNewID(typeof(odfMesh)); frame.MeshId = newMesh.Id; parser.MeshSection.AddChild(newMesh); } Dictionary<ObjectID, ObjectID> submeshIDtranslation = new Dictionary<ObjectID, ObjectID>(newMesh.Count); odfSubmesh[] replaceSubmeshes = frameMesh != null ? new odfSubmesh[frameMesh.Count] : null; List<odfSubmesh> addSubmeshes = new List<odfSubmesh>(newMesh.Count); for (int i = 0; i < newMesh.Count; i++) { ObjectID[] texIDs = new ObjectID[4] { ObjectID.INVALID, ObjectID.INVALID, ObjectID.INVALID, ObjectID.INVALID }; odfMaterial mat = odf.FindMaterialInfo(materialNames[i], parser.MaterialSection); if (materials != null && mat == null) { ImportedMaterial impMat = ImportedHelpers.FindMaterial(materialNames[i], materials); if (impMat != null) { mat = CreateMaterial(impMat, parser.GetNewID(typeof(odfMaterial))); parser.MaterialSection.AddChild(mat); for (int j = 0; j < impMat.Textures.Length; j++) { string texName = impMat.Textures[j]; odfTexture tex = odf.FindTextureInfo(texName, parser.TextureSection); if (tex == null) { ImportedTexture impTex = ImportedHelpers.FindTexture(texName, textures); if (impTex != null) { tex = CreateTexture(impTex, parser.GetNewID(typeof(odfTexture)), parser.TextureSection._FormatType, Path.GetDirectoryName(parser.ODFPath)); parser.TextureSection.AddChild(tex); texIDs[j] = tex.Id; } } else { texIDs[j] = tex.Id; } } } } odfSubmesh newSubmesh = newMesh[i]; newSubmesh.Id = parser.GetNewID(typeof(odfSubmesh)); newSubmesh.MaterialId = mat != null ? mat.Id : ObjectID.INVALID; newSubmesh.TextureIds = texIDs; List<odfVertex> newVertexList = newSubmesh.VertexList; if (worldCoords[i]) { for (int j = 0; j < newVertexList.Count; j++) { newVertexList[j].Position = Vector3.TransformCoordinate(newVertexList[j].Position, transform); } } odfSubmesh baseSubmesh = null; odfBoneList newBones = null; int newBonesIdx = -1; int idx = indices[i]; if ((frameMesh != null) && (idx >= 0) && (idx < frameMesh.Count)) { baseSubmesh = frameMesh[idx]; submeshIDtranslation.Add(newSubmesh.Id, baseSubmesh.Id); for (int j = 0; j < baseSubmesh.TextureIds.Length; j++) { ObjectID texID = baseSubmesh.TextureIds[j]; newSubmesh.TextureIds[j] = texID; } newSubmesh.Name = new ObjectName(baseSubmesh.Name.Name, baseSubmesh.Name.Info); CopyUnknowns(baseSubmesh, newSubmesh, parser.MeshSection._FormatType); if ((bonesMethod == CopyMeshMethod.CopyOrder) || (bonesMethod == CopyMeshMethod.CopyNear)) { odfBoneList baseBones = odf.FindBoneList(baseSubmesh.Id, parser.EnvelopeSection); if (baseBones != null) { newBones = baseBones.Clone(); newBones.Id = ObjectID.INVALID;// parser.GetNewID(typeof(odfBoneList)); newBones.SubmeshId = newSubmesh.Id; newBonesIdx = parser.EnvelopeSection.IndexOf(baseBones); } } else if (bonesMethod == CopyMeshMethod.Replace) { newBones = CreateBoneList(ObjectID.INVALID/*parser.GetNewID(typeof(odfBoneList))*/, frame.Id, newSubmesh, mesh.BoneList, transform, parser.FrameSection.RootFrame); newBonesIdx = parser.EnvelopeSection.Count; } } else { CreateUnknowns(newSubmesh, parser.MeshSection._FormatType); newBones = CreateBoneList(ObjectID.INVALID/*parser.GetNewID(typeof(odfBoneList))*/, frame.Id, newSubmesh, mesh.BoneList, transform, parser.FrameSection.RootFrame); newBonesIdx = parser.EnvelopeSection.Count; } if (newBones != null) { parser.EnvelopeSection.InsertChild(newBonesIdx, newBones); } if (baseSubmesh != null) { if (normalsMethod == CopyMeshMethod.CopyOrder) { odf.CopyNormalsOrder(baseSubmesh.VertexList, newSubmesh.VertexList); } else if (normalsMethod == CopyMeshMethod.CopyNear) { odf.CopyNormalsNear(baseSubmesh.VertexList, newSubmesh.VertexList); } if (bonesMethod == CopyMeshMethod.CopyOrder) { odf.CopyBonesOrder(baseSubmesh.VertexList, newSubmesh.VertexList, newBones); } else if (bonesMethod == CopyMeshMethod.CopyNear) { odf.CopyBonesNear(baseSubmesh.VertexList, newSubmesh.VertexList, newBones); } } if ((baseSubmesh != null) && merge && replaceSubmeshesOption[i]) { replaceSubmeshes[idx] = newSubmesh; } else { addSubmeshes.Add(newSubmesh); } } if ((frameMesh != null) && merge) { newMesh.Clear(); newMesh.Capacity = replaceSubmeshes.Length + addSubmeshes.Count; for (int i = 0, submeshesRemoved = 0; i < replaceSubmeshes.Length; i++) { if (replaceSubmeshes[i] == null) { odfSubmesh newSubmesh = frameMesh[i - submeshesRemoved++]; frameMesh.RemoveChild(newSubmesh); // save the bone list from being deleted in RemoveMesh newMesh.AddChild(newSubmesh); } else { newMesh.AddChild(replaceSubmeshes[i]); } } newMesh.AddRange(addSubmeshes); } if (frameMesh != null) { RemoveMesh(parser, frameMesh, frame, false); parser.UsedIDs.Add((int)newMesh.Id, typeof(odfMesh)); frame.MeshId = newMesh.Id; List<ObjectID> removeKeyList = new List<ObjectID>(); foreach (odfSubmesh submesh in newMesh) { ObjectID newSubmeshID = submesh.Id; ObjectID baseSubmeshID; if (submeshIDtranslation.TryGetValue(newSubmeshID, out baseSubmeshID)) { if (odf.FindBoneList(baseSubmeshID, parser.EnvelopeSection) == null) { odfBoneList boneList = odf.FindBoneList(newSubmeshID, parser.EnvelopeSection); if (boneList != null) boneList.SubmeshId = baseSubmeshID; submesh.Id = baseSubmeshID; parser.UsedIDs.Remove((int)newSubmeshID); } foreach (KeyValuePair<ObjectID, ObjectID> pair in submeshIDtranslation) { if (pair.Value == baseSubmeshID) { removeKeyList.Add(pair.Key); } } foreach (ObjectID removeId in removeKeyList) { submeshIDtranslation.Remove(removeId); } removeKeyList.Clear(); } } } }
public void MarkNotInvalid(ObjectID objectID) { SafeInnerDataManager.MarkNotInvalid(objectID); }
void HandlePropertyChange(ObjectID objectID, PropertyID propertyID, object value) { var ob = m_world.GetObject<BaseObject>(objectID); Debug.Assert(ob.IsInitialized); ob.SetProperty(propertyID, value); }
public UseCharacterMessage(ObjectID CharacterID) : base(MessageTypeGameMode.UseCharacter) { this.CharacterID = CharacterID; }
public ReqPutMessage(ObjectID Item, ObjectID Target) : base(MessageTypeGameMode.ReqPut) { this.Item = Item; this.Target = Target; }
/// <summary> /// This will be null for Server. /// </summary> //Animation animation; /// <summary> /// Default constructor /// </summary> /// <param name="pID">playerID</param> /// <param name="oID">objectID</param> /// <param name="pos">position</param> public BoardObject(ObjectID objectID, BoardObjectClass ot, Position pos) { this.objectID = objectID; this.position = pos; this.boardObjectClass = ot; }
/// <summary> /// 销毁单位 /// </summary> /// <param name="objId">被删除单位ObjectId对象</param> public void DelDisplay(ObjectID objId) { DelDisplay(GetElementById(objId)); }
private bool DataContainerExistsInSubTransaction(ClientTransaction clientTransaction, ObjectID objectID) { return(clientTransaction.SubTransaction != null && clientTransaction.SubTransaction.DataManager.DataContainers[objectID] != null); }
public InventoryRemoveMessage(ObjectID ID) : base(MessageTypeGameMode.InventoryRemove) { this.ID = ID; }
public ReqLookMessage(ObjectID RequestID) : base(MessageTypeGameMode.ReqLook) { this.RequestID = RequestID; }
public void Clear(bool RaiseChangedEvent) { if (RaiseChangedEvent) { OverlayFileRID = 0; FirstAnimationType = 0; ColorTranslation = 0; Effect = 0; Animation = new AnimationNone(); Source = new ObjectID(0); Target = new ObjectID(0); Speed = 0; Flags = 0; LightFlags = 0; LightIntensity = 0; LightColor = 0; OverlayFile = String.Empty; } else { overlayFileRID = 0; firstAnimationType = 0; colorTranslation = 0; effect = 0; animation = new AnimationNone(); source = new ObjectID(0); target = new ObjectID(0); speed = 0; flags = 0; lightFlags = 0; lightIntensity = 0; lightColor = 0; overlayFile = String.Empty; } }
public UseMessage(ObjectID NewEquippedItem) : base(MessageTypeGameMode.Use) { this.NewEquippedItem = NewEquippedItem; }
public override string ToString() { return(CutObject?.ToString() ?? (ObjectID.ToString() + ": " + Name.ToString())); }
public DataContainer GetDataContainerWithLazyLoad(ObjectID objectID, bool throwOnNotFound) { return(SafeInnerDataManager.GetDataContainerWithLazyLoad(objectID, throwOnNotFound)); }
/// <summary> /// Returns parameters according to the upload mode. /// </summary> private string GetModeParameters() { string[] args; if (MediaLibraryID > 0) { // MediaLibrary mode args = new[] { "MediaLibraryID", MediaLibraryID.ToString(), "MediaFolderPath", MediaFolderPath, "MediaFileID", MediaFileID.ToString(), "IsMediaThumbnail", IsMediaThumbnail.ToString(), "MediaFileName", MediaFileName }; return("MediaLibraryArgs=" + GetArgumentsString(args, UploaderHelper.MEDIA_LIBRARY_ARGS_HASHING_PURPOSE)); } if ((NodeID > 0) && (SourceType == MediaSourceEnum.Content)) { // File mode args = new[] { "NodeID", NodeID.ToString(), "DocumentCulture", DocumentCulture, "IncludeExtension", IncludeExtension.ToString(), "NodeGroupID", NodeGroupID.ToString() }; return("FileArgs=" + GetArgumentsString(args, UploaderHelper.FILE_ARGS_HASHING_PURPOSE)); } if (ObjectID > 0) { // MetaFile mode args = new[] { "MetaFileID", MetaFileID.ToString(), "ObjectID", ObjectID.ToString(), "SiteID", SiteID.ToString(), "ObjectType", ObjectType, "Category", Category }; return("MetaFileArgs=" + GetArgumentsString(args, UploaderHelper.META_FILE_ARGS_HASHING_PURPOSE)); } if (PostForumID > 0) { // Forum attachment args = new[] { "PostForumID", PostForumID.ToString(), "PostID", PostID.ToString() }; return("ForumArgs=" + GetArgumentsString(args, UploaderHelper.FORUM_ARGS_HASHING_PURPOSE)); } if ((DocumentID > 0) || (FormGUID != Guid.Empty)) { // Attachment mode args = new[] { "DocumentID", DocumentID.ToString(), "DocumentParentNodeID", DocumentParentNodeID.ToString(), "NodeClassName", NodeClassName, "AttachmentGUIDColumnName", AttachmentGUIDColumnName, "AttachmentGUID", AttachmentGUID.ToString(), "AttachmentGroupGUID", AttachmentGroupGUID.ToString(), "FormGUID", FormGUID.ToString(), "IsFieldAttachment", mIsFiledAttachment.ToString(), "FullRefresh", FullRefresh.ToString() }; return("AttachmentArgs=" + GetArgumentsString(args, UploaderHelper.ATTACHEMENT_ARGS_HASHING_PURPOSE)); } return(String.Empty); }
public void AddObjectIDFilter(MatchType op, ObjectID oid) { AddFilter(Filter.FilterHeaderObjectID, oid.ToBase58String(), op); }
public MovableObject(World world, ObjectID objectID) : base(world, objectID) { }
public DataContainer LoadLazyDataContainer(ObjectID objectID) { return(SafeInnerDataManager.LoadLazyDataContainer(objectID)); }