Пример #1
0
    public static IUnityInteractiveObject InteractiveFactory(InteractiveType interactableObject)
    {
        IUnityInteractiveObject obj;

        switch (interactableObject)
        {
        case InteractiveType.Base:
            obj = new InteractiveObject();
            break;

        case InteractiveType.Supply:
            obj = new AmmunitionCrate();
            break;

        case InteractiveType.ObjectiveDescription:
            obj = new Objective();
            break;

        case InteractiveType.Dialog:
            obj = new Dialog();
            break;

        default:
            obj = new InteractiveObject();
            break;
        }
        return(obj);
    }
Пример #2
0
        public void Copy(FriendsInfo friend)
        {
            if (friend == null)
            {
                return;
            }
            this.BattlePower = friend.BattlePower;
            this.SocietyPos  = friend.SocietyPos;
            this.Level       = friend.Level;
            this.RoleId      = friend.RoleId;
            this.Uid         = friend.Uid;
            this.TeamId      = friend.TeamId;

            this.Name        = friend.Name;
            this.SocietyName = friend.Name;
            this.Honor       = friend.Honor;

            this.Online = friend.Online;

            this.Interactive  = friend.Interactive;
            this.Intimacy     = friend.Intimacy;
            this.TransferLv   = friend.TransferLv;
            this.VipLv        = friend.VipLv;
            this.MateName     = friend.MateName;
            this.MateUUID     = friend.MateUUID;
            this.BubbleId     = friend.BubbleId;
            this.PhotoFrameId = friend.PhotoFrameId;
        }
        public int GetInteractiveCount(InteractiveType interactiveId)
        {
            int interactiveCount;

            if (interactivesInfo.TryGetValue(interactiveId, out interactiveCount))
            {
                return(interactiveCount);
            }
            return(0);
        }
        public bool HasInteractive(InteractiveType interactiveId, int interactiveCount = 1)
        {
            int count = 0;

            if (interactivesInfo.TryGetValue(interactiveId, out count))
            {
                return(count >= interactiveCount);
            }
            return(false);
        }
        public void SetInteractive(InteractiveType interactiveId, int interactiveCount)
        {
            int count = 0;

            if (interactivesInfo.TryGetValue(interactiveId, out count))
            {
                interactivesInfo.Remove(interactiveId);
            }

            if (interactiveCount > 0)
            {
                interactivesInfo.Add(interactiveId, interactiveCount);
            }
            SaveInteractiveCount();
        }
        public void AddInteractive(InteractiveType interactiveId, int interactiveCount = 1)
        {
            int count = 0;

            if (interactivesInfo.TryGetValue(interactiveId, out count))
            {
                interactivesInfo.Remove(interactiveId);
            }
            int newCount = count;

            if (int.MaxValue - interactiveCount > count)
            {
                newCount = interactiveCount + count;
            }
            interactivesInfo.Add(interactiveId, newCount);
            SaveInteractiveCount();
        }
Пример #7
0
 /// <summary>
 /// 添加课程互动
 /// </summary>
 /// <param name="userid">会员ID</param>
 /// <param name="courseid">课程ID</param>
 /// <param name="replyid">回复ID(评论、提问传0)</param>
 /// <param name="content">内容</param>
 /// <param name="type">InteractiveType 类型</param>
 /// <param name="integral">提问悬赏积分</param>
 /// <param name="operateIP">操作IP</param>
 /// <param name="operateID">操作ID</param>
 /// <param name="result">返回状态 1成功 0不成功</param>
 /// <returns></returns>
 public int AddCourseInteraction(string userid, string courseid, int replyid, string content, InteractiveType type, double integral, string operateIP, string operateID,out int result)
 {
     return new CourseDAL().AddCourseInteraction(userid, courseid, replyid, content, (int)type, integral, operateIP, operateID, out result);
 }
Пример #8
0
        /// <summary>
        /// 获取评论、问题列表
        /// </summary>
        /// <param name="courseid">课程ID 可为空</param>
        /// <param name="type">InteractiveType 类型</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="index">页码</param>
        /// <param name="total">总记录数</param>
        /// <param name="pages">总页数</param>
        /// <returns></returns>
        public static List<Entity.UserInteraction> GetUserInteractions(string courseid, InteractiveType type, int pageSize, int index, out int total, out int pages)
        {
            List<Entity.UserInteraction> list = new List<UserInteraction>();

            string table = "UserInteraction ui join Users u on ui.UserID=u.UserID";
            string columns = "ui.*,u.PetName ,u.PhotoPath";
            StringBuilder build = new StringBuilder();
            build.Append(" ui.Status <> 9 and ui.IsReply='0' and ui.Type=" + (int)type);

            if (!string.IsNullOrEmpty(courseid) && courseid != "1")
            {
                build.Append(" and ui.CourseID='" + courseid + "'");
            }

            DataTable dt = CommonBusiness.GetPagerData(table, columns, build.ToString(), "ui.ID", pageSize, index, out total, out pages);

            foreach (DataRow dr in dt.Rows)
            {
                UserInteraction model = new UserInteraction();
                model.FillData(dr);
                list.Add(model);
            }

            return list;
        }
 //给入口状态的接口
 public void SetInteractiveType(InteractiveType interactiveType)
 {
     interactive = interactiveType;
 }