private void NotifyChange(DataRole role, object newValue, object oldValue)
    {
        var change = new Change {
            role = role, newValue = newValue, oldValue = oldValue
        };

        if (changed != null)
        {
            changed(this, change);
        }

        MathBook book = mathBook;

        // If the field is being removed from a book then send the notification through the former book
        if (role == DataRole.Owner)
        {
            if (oldValue != null)
            {
                book = oldValue as MathBook;
            }
        }

        if (book != null)
        {
            book.inputOutputs.NotifyFieldChange(this, change);
        }
    }
Пример #2
0
    public bool SetMount(int mountID)
    {
        XRole role = DataManager.Instance.GetCurRole();

        if (role == null)
        {
            return(false);
        }
        role.MountID = mountID;
        DataRole.Update(role.Id, role);
        return(true);
    }
Пример #3
0
    public bool AddRole(int roleId, string name)
    {
        if (Roles.ContainsKey(roleId))
        {
            return(false);
        }
        XRole role = new XRole();

        role.Id       = roleId;
        role.Level    = 1;
        role.Name     = name;
        role.VipLevel = 0;
        role.CurExp   = 0;
        role.Position = Vector3.zero;
        role.Rotation = Vector3.zero;
        DataRole.Insert(roleId, role);
        return(true);
    }