Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Friend model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + databaseprefix + "friend(");
            strSql.Append("uid,friend_id)");
            strSql.Append(" values (");
            strSql.Append("@uid,@friend_id)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@uid",       SqlDbType.Int, 4),
                new SqlParameter("@friend_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.UId;
            parameters[1].Value = model.FriendId;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #2
0
        /// <summary>
        /// 查询所有好友:用户ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List <Model.Friend> QueryFriendsU_ID(int id)
        {
            string text = "select * from tb_user where u_id=:id";
            List <Model.Friend> list = new List <Model.Friend>();

            OracleParameter[] pars = new OracleParameter[]
            {
                new OracleParameter("id", id)
            };
            OracleDataReader odr = OracleHelper.QueryMore(text, pars);

            if (odr.HasRows)
            {
                while (odr.Read())
                {
                    Model.Friend friend = new Model.Friend();
                    friend.id          = int.Parse(odr["f_id"].ToString());
                    friend.userId      = int.Parse(odr["U_ID"].ToString());
                    friend.name        = odr["f_NAME"].ToString();
                    friend.desctiption = odr["f_description"].ToString();
                    list.Add(friend);
                }
            }
            odr.Close();
            return(list);
        }
Exemple #3
0
        /// <summary>
        /// 添加好友
        /// </summary>
        /// <param name="u"></param>
        /// <returns></returns>
        public int AddFriend(Model.Friend f)
        {
            string text = "insert into friend(F_NAME,U_ID,F_DESCRIPTION) values(:name,:u_id,:description)";

            OracleParameter[] pars = new OracleParameter[3]
            {
                new OracleParameter("name", f.name),
                new OracleParameter("u_id", f.userId),
                new OracleParameter("description", f.desctiption)
            };
            return(OracleHelper.ExecuteNonQuery(text, pars));
        }
Exemple #4
0
 /// <summary>
 /// 添加一条记录
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Add(Model.Friend model)
 {
     return(dal.Add(model));
 }
Exemple #5
0
        //Huvudmetod för utritning av spelets grafiska/visuella komponenter
        internal void DrawAndUpdate(float a_elapsedTime)
        {
            //Hämtar spelarObjekt
            Model.Player player = m_gameModel.m_playerSystem.m_player;

            //Uppdaterar kamera
            m_camera.UpdateCamera();

            //Påbörjar utritning
            m_spriteBatch.Begin();

            #region Draw

            //Ritar bakgrund
            m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexBackgroundLayerOne, m_camera.GetScreenRectangle, 0f);
            m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexBackgroundLayerTwo, m_camera.GetScreenRectangle, 0f);
            m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexBackgroundLayerThree, m_camera.GetScreenRectangle, 0f);

            m_inputHandler.MouseIsOverLoot = false;

            //Ritar Items
            DrawItems(a_elapsedTime);

            //Ritar spelare, enemies, NPCs
            m_unitView.DrawAndUpdateUnits(a_elapsedTime);

            //Ritar spells
            DrawSpells(m_gameModel.m_playerSystem.m_spellSystem.ActiveSpells, a_elapsedTime);
            DrawSpells(m_gameModel.m_enemySystem.m_enemySpellSystem.ActiveSpells, a_elapsedTime);

            //Ritar förgrund
            if (m_gameModel.m_level.foregroundVisible)
            {
                m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexForeground, m_camera.GetScreenRectangle, 0f);
            }

            #region Dialogrutor

            //Triggar utritning av quest meddelanden
            if (player.Target != null)
            {
                if (player.Target.GetType() == Model.GameModel.FRIENDLY_NPC)
                {
                    Model.Friend npc = player.Target as Model.Friend;

                    if (m_inputHandler.DidGetTargetedByLeftClick(m_camera.VisualizeRectangle(npc.ThisUnit.Bounds)) &&
                        npc.ThisUnit.Bounds.Intersects(player.CollisionArea) && npc.CanInterract)
                    {
                        m_conversation.DrawDialog = true;
                    }
                    else if (!npc.ThisUnit.Bounds.Intersects(player.CollisionArea))
                    {
                        m_conversation.DrawDialog = false;
                    }

                    bool isQuestNpc = false;

                    if (npc.UnitId == m_gameModel.m_questSystem.ActiveNpc)
                    {
                        isQuestNpc = true;
                    }

                    if (m_conversation.DrawDialog)
                    {
                        m_conversation.DrawNPCText(player.Target, isQuestNpc);
                    }
                }
            }

            #endregion

            //Ritar UserInterface
            m_UIView.DrawAndUpdate(a_elapsedTime);

            //Uppdaterar och ritar zonetexter
            DrawZoneText();

            #region Utritning av objektlager (DEBUG)

            //if (m_inputHandler.PressedAndReleased('V'))
            //{
            //    m_showDebug = !m_showDebug;
            //}

            //if (m_showDebug)
            //{
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexCollision, m_camera.GetScreenRectangle, 0f);
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexInteraction, m_camera.GetScreenRectangle, 0f);
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexFriendlyNPC, m_camera.GetScreenRectangle, 0f);
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexEnemyNPC, m_camera.GetScreenRectangle, 0f);
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexItems, m_camera.GetScreenRectangle, 0f);
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexPlayer, m_camera.GetScreenRectangle, 0f);
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexEnemyZone, m_camera.GetScreenRectangle, 0f);
            //    m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexGraveyard, m_camera.GetScreenRectangle, 0f);
            //}

            #endregion

            #endregion

            m_spriteBatch.End();

            //Repeterar uppdatering av kamera (Buggfix)
            m_camera.UpdateCamera();

            //Uppdaterar och spelar spelmusik
            UpdateMusic();
        }