コード例 #1
0
 public static void Init()
 {
     _viewCount = 0;
     InitPanel();
     InitDialog();
     LogManager.Assert(_viewCount == ((int)E_ViewId.MAX - 1), "注册的UI数量不对");
 }
コード例 #2
0
        public void InitData <T>(List <T> dataList)
        {
            LogManager.Assert(_itemObj != null, "预设不能为空");
            if (_itemObj == null)
            {
                return;
            }
            if (_listEnhanceItems.Count <= 0)
            {
                int num = dataList.Count;
                for (int i = 0; i < num; i++)
                {
                    GameObject go = Instantiate(_itemObj);
                    go.transform.SetParent(transform, false);
                    EnhanceItem item = go.GetComponent <EnhanceItem>();

                    item.EnhanceScrollView = this;
                    item.ListIndex         = i;
                    item.ListCount         = num;
                    _listEnhanceItems.Add(item);

                    if (IsVertical)
                    {
                        item.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, -90));
                    }
                }
            }

            for (int i = 0; i < _listEnhanceItems.Count; i++)
            {
                _listEnhanceItems[i].SetData(dataList[i]);
            }
            InitView();
        }
コード例 #3
0
        public bool GetNextTran(StateNodeBase cur_node, int action, out StateNodeBase next_node)
        {
            //find transitions of _cur_node
            Dictionary <int, ST_CondSet> action_trans_map;
            bool suc = _tran_map.TryGetValue(cur_node, out action_trans_map);

            if (!suc)
            {
                LogManager.Warning("transgraph[{0}] : cur_node[{1}] has no transitions", _name, cur_node._name);
                next_node = null;
                return(false);
            }
            LogManager.Assert(action_trans_map != null, "GetNextTran Error111");
            //find transition of (_cur_node, action)
            ST_CondSet cond_set;

            suc = action_trans_map.TryGetValue(action, out cond_set);
            if (!suc)
            {
                //                my.warning("_cur_node[{0}]--action[{1}] has no transition", cur_node._name, action);
                next_node = null;
                return(false);
            }
            LogManager.Assert(cond_set != null, "GetNextTran Error222");
            next_node = cond_set.GetResult();

            return(next_node != null);
        }
コード例 #4
0
        public void AddTran(StateTransition trans)
        {
            //step1. check conflict
            LogManager.Assert(!_check_conflict(trans), "new trans conflict with other trans");

            //step2. add
            //condition a : single transition
            if (trans is ST_Single)
            {
                ST_Single single_tran = trans as ST_Single;
                _single_tran_set.Add(single_tran);

                _add_single_tran(single_tran);
            }
            //condition b : group transition
            else if (trans is ST_Group)
            {
                ST_Group group_tran = trans as ST_Group;
                _group_tran_set.Add(group_tran);

                foreach (var single_tran in group_tran.trans_list)
                {
                    _add_single_tran(single_tran);
                }
            }
            else
            {
                LogManager.Error("AddTran : transition type [{0}] unhandled", trans.GetType());
            }
        }
コード例 #5
0
        public void RemoveTran(StateTransition trans)
        {
            if (trans is ST_Single)
            {
                ST_Single single_tran = trans as ST_Single;

                //remove from set
                LogManager.Assert(_single_tran_set.Contains(single_tran), "RemoveTran Error11");
                _single_tran_set.Remove(single_tran);

                //remove from map
                _remove_single_tran(single_tran);
            }
            else if (trans is ST_Group)
            {
                ST_Group group_tran = trans as ST_Group;

                //remove from set
                LogManager.Assert(_group_tran_set.Contains(group_tran), "RemoveTran Error22");
                _group_tran_set.Remove(group_tran);

                //remove from map
                foreach (var st_single in group_tran.trans_list)
                {
                    _remove_single_tran(st_single);
                }
            }
            else
            {
                LogManager.Error("Remove Tran : transition type [{0}] unhandled", trans.GetType());
            }
        }
コード例 #6
0
 public static void Assert(bool condition, string message)
 {
     if (!LogManager._openSkill)
     {
         return;
     }
     LogManager.Assert(condition, message);
 }
コード例 #7
0
 public static void Assert(bool condition, string message, params object[] args)
 {
     if (!LogManager._openSkill)
     {
         return;
     }
     LogManager.Assert(condition, message, args);
 }
コード例 #8
0
 // Use this for initialization
 void Awake()
 {
     LogManager.Assert(_instance == null, "多次重复实例化PanelManager");
     _instance = this;
     _mgrRoot  = transform;
     PanelManagerConfig.Init();
     _panelHistoryStack.OnOpen  += _real_open;
     _panelHistoryStack.OnClose += _real_close;
 }
コード例 #9
0
 public override bool IsEnd()
 {
     LogManager.Assert(_shakeFunc != null, "[IsEnd] please set a shake func");
     if (_shakeFunc == null)
     {
         return(true);
     }
     return(_shakeFunc.IsEnd());
 }
コード例 #10
0
 public void _store_in_set(StateNodeBase[] state_nodes)
 {
     LogManager.Assert(_node_set.Count == 0, "StateNodeGroup duplicate init!");
     foreach (var node in state_nodes)
     {
         LogManager.Assert(!_node_set.Contains(node), string.Format("duplicate node {0}", node._name));
         _node_set.Add(node);
     }
 }
コード例 #11
0
 public void UnLoad()
 {
     _abList.Clear();
     LogManager.Assert(_assetbundle != null, "AssetBundleInfo UnLoad. AssetBundle不能为空:[{0}]", _cnf.PackagePath);
     if (_assetbundle != null)
     {
         _assetbundle.Unload(true);
     }
     _assetbundle = null;
     _cnf         = null;
 }
コード例 #12
0
        public TreeNode AddChild(TreeNode node)
        {
            if (_maxChildCount > 0 && _childs.Count >= _maxChildCount)
            {
                LogManager.Error("行为树节点个数已经到达最大数");
                return(this);
            }

            LogManager.Assert(node._parentNode == null, "这个节点的爸爸不为空:[{0}]", node._nodeDes);
            node._parentNode = this;
            _childs.Add(node);
            return(this);
        }
コード例 #13
0
        //from + action是【因】
        //to 是【果】
        public ST_Single(StateNodeBase from_node, StateNodeBase to_node, int action, ST_Condition st_cond = null)
        {
            LogManager.Assert(from_node != null, "from node is null");
            LogManager.Assert(to_node != null, "to node is null");
            LogManager.Assert(action > 0, "action <= 0");

            LogManager.Assert(!string.Equals(from_node._name, to_node._name), string.Format("same type of node: [{0}]", from_node._name));

            _from_node = from_node;
            _to_node   = to_node;
            _action    = action;

            _st_cond = st_cond ?? ST_Condition.FullPass;
        }
コード例 #14
0
        public void _finish_connect(IAsyncResult ar)
        {
            if (_socket == null)
            {
                return;
            }
            lock (_socket)
                _socket.EndConnect(ar);

            LogManager.Assert(_socket.Connected, "Socket BeginConnect finish.but Socket Connected is false");
            if (!_socket.Connected)
            {
                return;
            }
            NetworkEventSystem.Instance.RaiseEvent(E_NetModule.socket_connected, null);
        }
コード例 #15
0
        public ST_Group(StateNodeGroup from_group, int action, StateNodeBase to_node)
        {
            LogManager.Assert(!StateNodeGroup.IsNullOrEmpty(from_group), "from node is null or empty");
            LogManager.Assert(to_node != null, "to node is null");
            LogManager.Assert(action > 0, "action <= 0");
            LogManager.Assert(!string.Equals(from_group._name, to_node._name), string.Format("same type of node: [{0}]", from_group._name));

            _from_group = from_group;
            _to_node    = to_node;
            _action     = action;
            foreach (var node in _from_group)
            {
                trans_list.Add(new ST_Single(node, _to_node, _action));
            }

            _st_cond = ST_Condition.FullPass;
        }
コード例 #16
0
        public void _remove_single_tran(ST_Single single_tran)
        {
            //assert from_node exist
            string err_msg = string.Format("Remove: trans[{0}] does not exist!", single_tran);

            LogManager.Assert(_tran_map.ContainsKey(single_tran._from_node), err_msg);

            //assert from_node + action exist
            Dictionary <int, ST_CondSet> action_trans_map = _tran_map[single_tran._from_node];

            LogManager.Assert(action_trans_map.ContainsKey(single_tran._action), err_msg);

            ST_CondSet cond_set = action_trans_map[single_tran._action];

            LogManager.Assert(cond_set != null, "_remove_single_tran Error");

            cond_set.Remove(single_tran);
        }
コード例 #17
0
        public bool AddFrame(FrameData data)
        {
            if (data == null)
            {
                return(false);
            }

            int  trunIndex = data.FrameIndex / 5;
            bool inTrun    = trunIndex == (TrunIndex + 1);

            LogManager.Assert(inTrun, "当前帧回合:[{0}],逻辑回合:[{1}],两个不匹配", TrunIndex, data.FrameIndex);
            if (!inTrun)
            {
                return(false);
            }

            Datas.Add(data);
            return(true);
        }
コード例 #18
0
        private void InternalCheckInfo()
        {
            LogManager.Assert(_onLoadingRequest.Count == _onLoadingAbPackage.Count, "AssetBundleLoader OnLoading Request List!=Name List");

            LogManager.Log("--------------------资源数量:[{0}]--------------------", _packageMap.Count);
            int length = _onLoadingRequest.Count;

            LogManager.Log("--------------------加载中的请求:[{0}]--------------------", length);
            for (int i = 0; i < length; i++)
            {
                ResLog.Log(_onLoadingRequest[i].RequestResPath);
            }

            LogManager.Assert(_waitToLoadRequest.Count == _onWaitAbPackage.Count, "OnWait Request List!=Name List");
            length = _waitToLoadRequest.Count;
            LogManager.Log("--------------------等待中的请求:[{0}]--------------------", length);
            for (int i = 0; i < length; i++)
            {
                ResLog.Log(_waitToLoadRequest[i].RequestResPath);
            }
        }
コード例 #19
0
        public AssetBundlePackageCnf(string[] infos)
        {
            PackagePath = infos[0];
            string.Intern(PackagePath);

            // TODO 可以优化 这块需要考虑到远程加载的问题 是加载本地的还是更新文件
            FullPath = _fullPath + PackagePath;
            string.Intern(FullPath);

            for (int i = 1; i < infos.Length; i = i + 2)
            {
                bool result = _resPathMap.ContainsKey(infos[i]);
                LogManager.Assert(!result, "初始化AssetBundle的依赖信息失败,[{0}]", infos[i]);
                if (result)
                {
                    continue;
                }

                _resPathMap.Add(infos[i], infos[i + 1]);
                _resNames.Add(infos[i + 1], infos[i]);
            }
        }
コード例 #20
0
        public void Play(SoundCnf info, float volumeRate = 1f, float fadeIn = 0f, float fadeOut = 0f)
        {
            LogManager.Assert(_audioSource != null, "声音缺少Source组件");
            if (_audioSource == null)
            {
                return;
            }

            // 1.初始化数据
            _soundInfo  = info;
            _volumeRate = volumeRate;
            // 3.初始化数据
            _init_sound_info();

            // 2.设置淡入淡出效果
            //effect.Set(_length, fade_in, fade_out);
            //float rate = effect.OnUpdate(0.01f);
            //_set_volume(rate);

            // 播放
            _internal_play();
        }
コード例 #21
0
 public void Add(ST_Single st_single)
 {
     LogManager.Assert(!_cond_map.ContainsKey(st_single._to_node), string.Format("duplcate add {0}", st_single));
     _cond_map.Add(st_single._to_node, st_single._st_cond);
 }
コード例 #22
0
 public void Remove(ST_Single st_single)
 {
     LogManager.Assert(_cond_map.ContainsKey(st_single._to_node), string.Format("trans not exist! {0}", st_single));
     _cond_map.Remove(st_single._to_node);
 }
コード例 #23
0
 public ST_Condition(Func <bool> cond_func)
 {
     LogManager.Assert(cond_func != null, "func=null");
     _cond_func = cond_func;
 }
コード例 #24
0
 public StateNodeGroup(string name, params StateNodeBase[] state_nodes)
 {
     LogManager.Assert(state_nodes.Length > 0, "length of state_node <= 0");
     _name = name;
     _store_in_set(state_nodes);
 }