Ejemplo n.º 1
0
    private void FileNode(int serverId, string nodeGuid)
    {
        GameServer server = TheAdminServer.GameServerManager.GetGameServer(serverId);

        if (server == null)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
            return;
        }
        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return;
        }

        ArrayList paramList = new ArrayList();
        string    cmdText   = "SELECT NodeName,LeaderName,LayerId,NodeGUID,ChildCount FROM socialrelation WHERE {0}='?'";

        paramList.Add(nodeGuid);

        SqlCommand cmd    = new SqlCommand(string.Format(cmdText, FS2TableString.SocialrelationFieldNodeGUID), paramList.ToArray());
        SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[] {
                SqlDataType.String,
                SqlDataType.String,
                SqlDataType.Int32,
                SqlDataType.String,
                SqlDataType.Int32
            });

            object[]           record;
            SocialRelationInfo socialRelationInfo = null;
            while ((record = result.ReadRecord()) != null)
            {
                socialRelationInfo = new SocialRelationInfo();

                socialRelationInfo.NodeName   = record[0] as string;
                socialRelationInfo.LeaderName = record[1] as string;
                socialRelationInfo.LayerId    = (int)record[2];
                socialRelationInfo.NodeGUID   = record[3] as string;
                socialRelationInfo.ChildCount = (int)record[4];
            }
            if (socialRelationInfo != null)
            {
                switch (socialRelationInfo.LayerId)
                {
                case 2:
                    //氏族显示成员(Role)
                    LabelTitle.Text = string.Format("{0}[{1}] {2}:{3}", StringDef.Clan, socialRelationInfo.NodeName, StringDef.MemberCount, socialRelationInfo.ChildCount);
                    QueryRole(serverId, nodeGuid);
                    break;

                case 3:
                case 4:
                    //诸侯和国家
                    LabelTitle.Text = string.Format("{0}[{1}] {2}:{3}", socialRelationInfo.LayerId == 3 ? StringDef.Seigneur : StringDef.Nation, socialRelationInfo.NodeName, StringDef.MemberCount, socialRelationInfo.ChildCount);
                    QueryNode(serverId, nodeGuid);
                    break;
                }
            }
        }
    }
Ejemplo n.º 2
0
    private void FileNode(int serverId,string nodeGuid)
    {
        GameServer server = TheAdminServer.GameServerManager.GetGameServer(serverId);
        if (server == null)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
            return;
        }
        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return;
        }

        ArrayList paramList = new ArrayList();
        string cmdText = "SELECT NodeName,LeaderName,LayerId,NodeGUID,ChildCount FROM socialrelation WHERE {0}='?'";
        paramList.Add(nodeGuid);

        SqlCommand cmd = new SqlCommand(string.Format(cmdText, FS2TableString.SocialrelationFieldNodeGUID), paramList.ToArray());
        SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[]{
                SqlDataType.String,
                SqlDataType.String,
                SqlDataType.Int32,
                SqlDataType.String,
                SqlDataType.Int32            
            });

            object[] record;
            SocialRelationInfo socialRelationInfo = null;
            while ((record = result.ReadRecord()) != null)
            {
                socialRelationInfo = new SocialRelationInfo();
                
                socialRelationInfo.NodeName = record[0] as string;
                socialRelationInfo.LeaderName = record[1] as string;
                socialRelationInfo.LayerId = (int)record[2];
                socialRelationInfo.NodeGUID = record[3] as string;
                socialRelationInfo.ChildCount = (int)record[4];
            }
            if (socialRelationInfo != null)
            {
                switch (socialRelationInfo.LayerId)
                {
                    case 2:
                        //氏族显示成员(Role)
                        LabelTitle.Text = string.Format("{0}[{1}] {2}:{3}", StringDef.Clan, socialRelationInfo.NodeName, StringDef.MemberCount, socialRelationInfo.ChildCount);
                        QueryRole(serverId, nodeGuid);
                        break;
                    case 3:
                    case 4:
                        //诸侯和国家
                        LabelTitle.Text = string.Format("{0}[{1}] {2}:{3}", socialRelationInfo.LayerId == 3 ? StringDef.Seigneur : StringDef.Nation, socialRelationInfo.NodeName, StringDef.MemberCount, socialRelationInfo.ChildCount);
                        QueryNode(serverId, nodeGuid);
                        break;
                }
            }
        }
    }