public static void OnValueChanged(object obj, PropertyInfo prop, Stack stack) { if (stack == null || stack.Count == 0) { return; } if (!prop.PropertyType.IsValueType) { return; } IStackEntry peek = (IStackEntry)stack.Peek(); peek.OnValueChanged(obj); }
public PropertiesGump(Mobile mobile, object o, Stack stack, IStackEntry parent) : base(GumpOffsetX, GumpOffsetY) { m_Mobile = mobile; m_Object = o; m_Stack = stack; m_List = BuildList(); if (parent != null) { if (m_Stack == null) { m_Stack = new Stack(); } m_Stack.Push(parent); } Initialize(0); }
public override void OnResponse(GameClient state, RelayInfo info) { Mobile from = state.Mobile; if (!Scripts.Commands.BaseCommand.IsAccessible(from, m_Object)) { from.SendMessage("You may no longer access their properties."); return; } switch (info.ButtonID) { case 0: // Closed { if (m_Stack != null && m_Stack.Count > 0) { IStackEntry entry = (IStackEntry)m_Stack.Pop(); entry.SendGump(from, m_Stack); } break; } case 1: // Previous { if (m_Page > 0) { from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1)); } break; } case 2: // Next { if ((m_Page + 1) * EntryCount < m_List.Count) { from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1)); } break; } default: { int index = (m_Page * EntryCount) + (info.ButtonID - 3); if (index >= 0 && index < m_List.Count) { PropertyInfo prop = m_List[index] as PropertyInfo; if (prop == null) { return; } CPA attr = GetCPA(prop); if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel) { return; } Type type = prop.PropertyType; if (IsType(type, typeofMobile) || IsType(type, typeofItem)) { from.SendGump(new SetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List)); } else if (IsType(type, typeofType)) { from.Target = new SetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List); } else if (IsType(type, typeofPoint3D)) { from.SendGump(new SetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, typeofPoint2D)) { from.SendGump(new SetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, typeofTimeSpan)) { from.SendGump(new SetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, typeofDateTime)) { from.SendGump(new SetDateTimeGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsCustomEnum(type)) { from.SendGump(new SetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List, GetCustomEnumNames(type))); } else if (IsType(type, typeofEnum)) { from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Enum.GetNames(type), GetObjects(Enum.GetValues(type)))); } else if (IsType(type, typeofBool)) { from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames, m_BoolValues)); } else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric)) { from.SendGump(new SetGump(prop, from, m_Object, m_Stack, m_Page, m_List)); } else if (IsType(type, typeofPoison)) { from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues)); } else if (IsType(type, typeofMap)) { from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), Map.GetMapValues())); } else if (IsType(type, typeofSkills) && m_Object is Mobile) { from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page)); from.SendGump(new Scripts.Gumps.SkillsGump(from, (Mobile)m_Object)); } else if (HasAttribute(type, typeofPropertyObject, true)) { from.SendGump(new PropertiesGump(from, prop.GetValue(m_Object, null), m_Stack, new StackEntry(m_Object, prop))); } } break; } } }
public PropertiesGump( Mobile mobile, object o, Stack stack, IStackEntry parent ) : base(GumpOffsetX, GumpOffsetY) { m_Mobile = mobile; m_Object = o; m_Stack = stack; m_List = BuildList(); if ( parent != null ) { if ( m_Stack == null ) { m_Stack = new Stack(); } m_Stack.Push( parent ); } Initialize( 0 ); }