public ObjectID GetObjectID(ObjectID ident) { GameObj obj = GetObjectByIdent(ident); if (obj == null) { return(new ObjectID()); } return(obj.GetObjId()); }
private bool InnerRecvViewProperty(string strViewIdent, GameObj obj, LoadArchive loadAr, int count, bool change) { try { Var key = Var.zero; for (int i = 0; i < count; i++) { int index = 0; if (!loadAr.ReadInt16(ref index)) { return(false); } if (index >= mPropertyTable.Count) { return(false); } PropData propData = GetPropDataByIndex(index); propData.nCount = propData.nCount + 1; if (!InnerParsePropValue(loadAr, propData.nType, ref key)) { return(false); } if (!obj.UpdateProperty(ref propData.strName, key)) { return(false); } if (change) { VarList argList = VarList.GetVarList(); argList.AddString(strViewIdent); argList.AddString(obj.GetIdent()); argList.AddString(propData.strName); Excute_CallBack("on_view_object_property_change", argList); argList.Collect(); } } } catch (System.Exception ex) { LogSystem.Log("GameReceiver.InnerRecvViewProperty() Exception:", ex.ToString()); } return(true); }
public bool RecvProperty(ref GameObj obj, ref LoadArchive loadAr, int count, bool change) { try { return(InnerRecvProperty(obj, loadAr, count, change)); } catch (Exception ex) { //Log.Trace("GameReceiver.RecvProperty(GameObj) Exception:" + ex.ToString()); return(false); } }
public void GetObjectList(ref VarList result) { if (result == null) { return; } foreach (KeyValuePair <ObjectID, GameObj> kvp in mObjects) { GameObj obj = kvp.Value; if (obj != null && (!obj.GetIdent().IsNull())) { result.AddObject(obj.GetIdent()); } } }
public bool Change(string old_ident, string new_ident) { if (old_ident == null || new_ident == null || old_ident.Length == 0 || new_ident.Length == 0) { return(false); } try { if (!mObjects.ContainsKey(old_ident)) { return(false); } if (!mObjects.ContainsKey(new_ident)) { return(false); } GameObj oldObj = mObjects[old_ident]; GameObj newObj = mObjects[new_ident]; if (oldObj == null || newObj == null) { return(false); } newObj.SetIdent(old_ident); newObj.SetHash(Tools.GetHashValueCase(old_ident)); oldObj.SetIdent(new_ident); oldObj.SetHash(Tools.GetHashValueCase(new_ident)); } catch (Exception ex) { LogSystem.LogError("Error, exception ", ex.ToString()); return(false); } return(true); }
public bool Change(ObjectID old_ident, ObjectID new_ident) { if (old_ident.IsNull() || new_ident.IsNull()) { return(false); } try { if (!mObjects.ContainsKey(old_ident)) { return(false); } if (!mObjects.ContainsKey(new_ident)) { return(false); } GameObj oldObj = mObjects[old_ident]; GameObj newObj = mObjects[new_ident]; if (oldObj == null || newObj == null) { return(false); } newObj.SetIdent(old_ident); newObj.SetHash(Tools.GetHashValueCase(old_ident)); oldObj.SetIdent(new_ident); oldObj.SetHash(Tools.GetHashValueCase(new_ident)); } catch (Exception ex) { //Log.TraceError("Error, exception " + ex.ToString()); return(false); } return(true); }
public bool AddRecord(ref GameObj obj, int index) { try { if (index < 0 || index > mRecordTable.Count) { //Log.Trace("index error"); return(false); } if (null == obj) { //Log.Trace("obj is null"); return(false); } if (!mRecordTable.ContainsKey(index)) { //Log.Trace("not include index:" + index.ToString()); return(false); } RecData recData = mRecordTable[index]; GameRecord record = new GameRecord(); record.SetName(recData.strName); record.SetColCount(recData.nCols); for (int i = 0; i < recData.nCols; i++) { int type = recData.ColTypes[i]; switch (type) { case OuterDataType.OUTER_TYPE_BYTE: case OuterDataType.OUTER_TYPE_WORD: case OuterDataType.OUTER_TYPE_DWORD: { record.SetColType(i, VarType.Int); } break; case OuterDataType.OUTER_TYPE_QWORD: { record.SetColType(i, VarType.Int64); } break; case OuterDataType.OUTER_TYPE_FLOAT: { record.SetColType(i, VarType.Float); } break; case OuterDataType.OUTER_TYPE_DOUBLE: { record.SetColType(i, VarType.Double); } break; case OuterDataType.OUTER_TYPE_STRING: { record.SetColType(i, VarType.String); } break; case OuterDataType.OUTER_TYPE_WIDESTR: { record.SetColType(i, VarType.WideStr); } break; case OuterDataType.OUTER_TYPE_OBJECT: { record.SetColType(i, VarType.Object); } break; default: //Log.Trace("unkown type"); break; } }//end for return(obj.AddRecord2Set(recData.strName, ref record)); }//end try catch (Exception ex) { //Log.Trace("Exception:" + ex.ToString()); return(false); } }
private bool InnerRecvProperty(GameObj obj, LoadArchive loadAr, int count, bool change) { VarList.VarData key = new VarList.VarData(); for (int i = 0; i < count; i++) { int index = 0; if (!loadAr.ReadInt16(ref index)) { return(false); } if (index >= mPropertyTable.Count) { return(false); } PropData propData = GetPropDataByIndex(index); if (propData == null) { return(false); } propData.nCount = propData.nCount + 1; if (!InnerParsePropValue(loadAr, propData.nType, ref key)) { return(false); } if (!obj.UpdateProperty(ref propData.strName, key)) { return(false); } if (change) { VarList argList = new VarList(); argList.AddObject(obj.GetIdent()); argList.AddString(propData.strName); Excute_CallBack("on_object_property_change", argList); } } return(true); }