Пример #1
0
        public void Del(int _id, int _num)
        {
            ItemEntry entry;

            if (itemDict.TryGetValue(_id, out entry))
            {
                if (entry.Num > _num)
                {
                    itemDict[_id].Del(_num);
                    if (ItemDecreaseEvent != null)
                    {
                        ItemDecreaseEvent(_id);
                    }
                }
                else
                {
                    itemDict.Remove(_id);
                    if (ItemRemoveEvent != null)
                    {
                        ItemRemoveEvent(_id);
                    }
                }
            }
            else
            {
                WDebug.Log(string.Format("Can not find item of id :{0}", _id));
            }
        }
Пример #2
0
 protected override void AddListeners()
 {
     base.AddListeners();
     btnClick.onClick.AddListener(() => {
         WDebug.Log("fffff");
     }
                                  );
 }
Пример #3
0
    public void SetTrigger(int _trigger)
    {
        if (!stateDict.ContainsKey(_trigger))
        {
            WDebug.Log(string.Format("{0} is not registered!", _trigger));
            return;
        }

        nextState = stateDict[_trigger];
    }
Пример #4
0
        public int Query(FightAttribute _type)
        {
            if (!attributeDict.ContainsKey(_type))
            {
                WDebug.Log(string.Format("FightAttribute {0} is not exist!", _type));
                return(0);
            }

            return(attributeDict[_type].value);
        }
Пример #5
0
    static public RefSkill Get(int _id)
    {
        RefSkill r = null;

        if (!RefDataManager.Instance.skill.TryGetValue(_id, out r))
        {
            WDebug.Log(string.Format("Failed to get skil data by id:<color=yellow>{0}</color> ", _id));
        }

        return(r);
    }
Пример #6
0
    public void AddClock(DateTime _dateTime, int _repeatInterval, int _repeatTimes, Action _callBack)  //固定时刻触发
    {
        if (_dateTime < System.DateTime.Now || _repeatInterval < 1 || _repeatTimes < 1 || _callBack == null)
        {
            WDebug.Log("Invaild clock!");
            return;
        }
        Clock clock = new Clock(_dateTime, _repeatInterval, _repeatTimes, _callBack);

        clockList.Add(clock);
    }
Пример #7
0
    private void LoadSkill()
    {
        long startTick = DateTime.Now.Ticks;

        for (int i = 0; i < 100; i++)
        {
            skill = ParseRefData <RefSkill>("skill");
        }

        long endTicks = DateTime.Now.Ticks;

        WDebug.Log("时长:" + (endTicks - startTick) / 10000);
    }
Пример #8
0
    static public bool TryGet(int _id, out RefEffect _data)
    {
        bool successful = false;

        successful = RefDataManager.Instance.effect.TryGetValue(_id, out _data);

        if (!successful)
        {
            WDebug.Log(string.Format("Failed to get RefEffect data by id:<color=yellow>{0}</color> ", _id));
        }

        return(successful);
    }
Пример #9
0
        public void Add(FightAttribute _type, int _value)
        {
            if (!attributeDict.ContainsKey(_type))
            {
                WDebug.Log(string.Format("FightAttribute {0} is not exist!", _type));
                return;
            }
            attributeDict[_type].value += _value;

            if (AttributeChangeEvent != null)
            {
                AttributeChangeEvent(_type, attributeDict[_type].value);
            }
        }
Пример #10
0
        /// <summary>
        /// 销毁窗口
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public void DestroyWin(int _id)
        {
            WindowViewBase win = null;

            if (TryGetWindow(_id, out win))
            {
                windowDict.Remove(_id);
                win.DoDestroy();
            }
            else
            {
                WDebug.Log(string.Format("Id为:{0}的窗口无法获得!", _id));
            }
        }
Пример #11
0
    IEnumerator Co_LoadScene(LoadSceneMode _mode, SceneAsyncOption _async)
    {
        var startProgress  = _async.progress;
        var asyncOperation = SceneManager.LoadSceneAsync(currentSceneName, _mode);

        while (asyncOperation != null && !asyncOperation.isDone)
        {
            _async.progress = startProgress + asyncOperation.progress * 0.5f;
            yield return(null);
        }

        if (_mode == LoadSceneMode.Single)
        {
            System.GC.Collect();
            Resources.UnloadUnusedAssets();
        }

        _async.progress = 1f;
        _async.done     = true;
        WDebug.Log(string.Format("Load {0} use<color=yellow> {1} </color>second", currentSceneName, _async.time));
    }
Пример #12
0
        /// <summary>
        /// 关闭窗口
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public WindowViewBase Close(int _id)
        {
            WindowViewBase win = null;

            if (TryGetWindow(_id, out win))
            {
                if (win.windowState == WindowViewBase.WindowState.Opened)
                {
                    win.Close();
                }
                else
                {
                    WDebug.Log(string.Format("Id为:{0}的窗口已经关闭!", _id));
                }
            }
            else
            {
                WDebug.Log(string.Format("Id为:{0}的窗口无法获得!", _id));
            }

            return(win);
        }
Пример #13
0
        /// <summary>
        /// 打开窗口
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T Open <T> (int _id) where T : WindowViewBase, new()
        {
            WindowViewBase win = null;

            if (TryGetWindow(_id, out win))
            {
                if (win.windowState == WindowViewBase.WindowState.Closed)
                {
                    CloseOtherNormalWindow(_id);
                    win.Open(_id);
                }
                else
                {
                    WDebug.Log(string.Format("Id为:{0}的窗口已经打开!", _id));
                }
            }
            else
            {
                WDebug.Log(string.Format("Id为:{0}的窗口无法获得!", _id));
            }

            return((T)win);
        }
Пример #14
0
 private void Update()
 {
     WDebug.Log(Time.frameCount.ToString());
 }