123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class GamePlayerData {
- private static GamePlayerData _instance;
- private bool isNeedNet;//是否是联网模式 如果是的话需要接收消息再做出响应
- public int user_id = -1;
- public int school_id;
- public string school_name;
- public string user_name;
- public int user_type;//0 老师 1学生 2 ipad端 3 可以创建公开课也可以创建本地课的 4后台管理员
- public bool is_create;
- public int max_ct;//默认的房间最大人数
- public ExperimentData eData;
- public string url_image_str = "http://bi.bellcat.cn";
- public bool isDebugAccount;//是超级账号 可以开启DebugLog
- public bool isOpenAudio = false;//语音模块是否可以启用
- public RoomData room_data;//房间信息
- public TeacherOperateData teacher_operate_data;//老师的操作信息
- public SocketRoomItemData CreateRoomdata;//创建的房间信息 每次创建的时候需要重新设置
-
- public static GamePlayerData Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new GamePlayerData();
- }
- return _instance;
- }
- }
- private GamePlayerData()
- {
- Engine.Net.NetMsgLog.IsDebugMsg = true;
- room_data = new RoomData();
- teacher_operate_data = new TeacherOperateData();
- teacher_operate_data.Init();
- CDebug.Log("GamePlayerData Init");
- }
- public void Dispose()
- {
- teacher_operate_data.Dispose();
- }
- public bool IsMaster {
- get {
- return user_type == 0 || user_type == 3;
- }
- }
- public bool IsStudent
- {
- get
- {
- return user_type == GameEnum.STUDENT_TYPE;
- }
- }
- public bool IsNeedNet { get { return isNeedNet; } }
- public bool RootCreatePublic
- {
- get { return user_type == 3; }//止呕管理员才能创建
- }
- public bool IsInRoom
- {
- get { return room_data.CurRoomId != -1; }
- }
- //是否需要发送操作信息给学生
- public bool NeedSendLineMsg()
- {
- //在房间里 而且是房主 房间里还有别人的时候
- return IsInRoom && room_data.IsReconnectOwner() && !room_data.IsEmptyUser;
- }
- //是否开启语音
- public bool IsNeedAudio()
- {
- return int.Parse(GameConfigData.Instance.course_data.GetCourseConfigById(room_data.CurOnlineData.course_id).open_audio) == 1;
- }
- public bool IsFangzhu()
- {
- if(room_data == null || room_data.CurOnlineData == null)
- {
- return false;
- }
- if(user_id == room_data.CurOnlineData.owner_id)
- {
- return true;
- }
- return false;
- }
- public string AudioRoomName()
- {
- if (room_data == null || room_data.CurOnlineData == null)
- {
- return user_name;
- }
- return room_data.CurOnlineData.AudioRoomName;
- }
- }
|