Beispiel #1
0
    public GuideModule GetModule(uint ID)
    {
        GuideModule module = null;

        modules.TryGetValue(ID, out module);
        return(module);
    }
Beispiel #2
0
    //界面关闭
    protected override void OnClose()
    {
        EventDelegate.Remove(OkBtn.onClick, OnClickClose);

        GuideModule module = ModuleManager.Instance.FindModule <GuideModule>();

        module.ForceHideGuide(false);
    }
Beispiel #3
0
    //界面关闭
    protected override void OnClose()
    {
        GuideModule module = ModuleManager.Instance.FindModule <GuideModule>();

        module.ForceHideGuide(false);

        InputSystem.Instance.SetLockMove(false);
    }
Beispiel #4
0
    //界面打开
    protected override void OnOpen(object param = null)
    {
        //强制隐藏引导
        GuideModule module = ModuleManager.Instance.FindModule <GuideModule>();

        module.ForceHideGuide(true);

        InputSystem.Instance.SetLockMove(true);
    }
Beispiel #5
0
    public void ReqBeginGuide(string uiName)
    {
        if (!GlobalConst.IS_GUIDE)
        {
            return;
        }
        if (checkUncompleted)
        {
            checkUncompleted = false;
            uint uncompletedGuide = MainPlayer.Instance.GetUncompletedGuide();
            if (uncompletedGuide != 0)
            {
                GuideModule module = GameSystem.Instance.GuideConfig.GetModule(uncompletedGuide);
                if (module.restartStep == 0)
                {
                    ReqBeginGuide(uncompletedGuide);
                    return;
                }
                else
                {
                    if (module.skipConditions.Count > 0)        //directly skip
                    {
                        if (ConditionValidator.Instance.Validate(module.skipConditions, module.skipConditionParams, true))
                        {
                            Debug.Log("Skip guide: " + module.ID);
                            ReqBeginGuide(module.ID);
                            return;
                        }
                    }

                    curStep = GameSystem.Instance.GuideConfig.GetStep(00001);
                    if (curStep == null)
                    {
                        Debug.LogError("GuideSystem: missing special step(00001) config.");
                    }
                    HighlightControls(curStep);
                    ShowTip(curStep);
                    return;
                }
            }
        }
        List <GuideModule> modules = GameSystem.Instance.GuideConfig.GetModules(uiName);

        if (modules != null)
        {
            foreach (GuideModule module in modules)
            {
                if (ReqBeginGuide(module.ID))
                {
                    break;
                }
            }
        }
    }
    public static bool ShowGuide(List <string> paramList)
    {
        if (paramList == null || paramList.Count != 1)
        {
            return(false);
        }

        GuideModule module = ModuleManager.Instance.FindModule <GuideModule>();

        module.EnterTrigger(int.Parse(paramList[0]));

        return(true);
    }
Beispiel #7
0
 void OnFinishStepClick(GameObject go)
 {
     if (curStep != null && curStep.ID != 00001)
     {
         EndCurStep();
     }
     else
     {
         StepClear();
         curStep = null;
         GuideModule module = GameSystem.Instance.GuideConfig.GetModule(MainPlayer.Instance.GetUncompletedGuide());
         UIManager.Instance.ShowSpecifiedUI(module.linkID, module.linkSubID);
         ReqBeginGuide(module.ID);
     }
 }
    private void OnUnlockComplete(int id, bool guide = true)
    {
        mUnlocks.Add(id, true);

        FunctionEvent evt = new FunctionEvent(FunctionEvent.FUNCTION_UNLOCKED);

        evt.functionid = id;
        EventSystem.Instance.PushEvent(evt);

        //触发引导
        if (guide)
        {
            GuideModule module = ModuleManager.Instance.FindModule <GuideModule>();
            module.OnFunctionUnlock(id);
        }
    }
Beispiel #9
0
        public static void Setup()
        {
            if (_isStepup)
            {
                return;
            }

            _isStepup = true;
            IModule module = new GuideModule();

            module.ModuleName = ModuleConfig.MODULE_GUIDE;

            module.Parent = Main.GuideCanvas.gameObject;
            module.LoadAssets();
            module.Init();
            _guideModule = (GuideModule)module;
        }
    static int _CreateGuideModule(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            GuideModule obj = new GuideModule();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: GuideModule.New");
        }

        return(0);
    }
Beispiel #11
0
    void EndGuide(uint moduleID, List <KeyValueData> awards = null)
    {
        Debug.Log("End guide " + moduleID);
        MainPlayer.Instance.SetGuideCompleted(moduleID);
        if (awards != null && awards.Count > 0)
        {
            ShowAwardsAcquire(awards);
        }
        GuideModule module = GameSystem.Instance.GuideConfig.GetModule(moduleID);

        if (module.nextModule != 0)
        {
            ReqBeginGuide(module.nextModule, isDebugging);
        }
        else
        {
            ReqBeginGuide(module.uiName);
        }
    }
Beispiel #12
0
        public static void Reset()
        {
            TempState = TempState.NONE;

            if (_remoteGuideDict != null)
            {
                _remoteGuideDict.Clear();
                _remoteGuideDict = null;
            }

            _isStepup = false;

            if (_guideModule != null)
            {
                _guideModule.Remove(0);
                _guideModule = null;
            }

            _openDict = new Dictionary <ModulePB, List <FunctionEntryPB> >();
        }
    static int get_skipConditionParams(IntPtr L)
    {
        object      o   = LuaScriptMgr.GetLuaObject(L, 1);
        GuideModule obj = (GuideModule)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name skipConditionParams");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index skipConditionParams on a nil value");
            }
        }

        LuaScriptMgr.PushObject(L, obj.skipConditionParams);
        return(1);
    }
    static int set_linkID(IntPtr L)
    {
        object      o   = LuaScriptMgr.GetLuaObject(L, 1);
        GuideModule obj = (GuideModule)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name linkID");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index linkID on a nil value");
            }
        }

        obj.linkID = LuaScriptMgr.GetString(L, 3);
        return(0);
    }
    static int get_uiName(IntPtr L)
    {
        object      o   = LuaScriptMgr.GetLuaObject(L, 1);
        GuideModule obj = (GuideModule)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name uiName");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index uiName on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.uiName);
        return(1);
    }
    static int set_skipConditionParams(IntPtr L)
    {
        object      o   = LuaScriptMgr.GetLuaObject(L, 1);
        GuideModule obj = (GuideModule)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name skipConditionParams");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index skipConditionParams on a nil value");
            }
        }

        obj.skipConditionParams = (List <string>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <string>));
        return(0);
    }
    static int set_nextModule(IntPtr L)
    {
        object      o   = LuaScriptMgr.GetLuaObject(L, 1);
        GuideModule obj = (GuideModule)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name nextModule");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index nextModule on a nil value");
            }
        }

        obj.nextModule = (uint)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Beispiel #18
0
 public bool ReqBeginGuide(uint id, bool debug = false)
 {
     Debug.Log("Request to begin guide module " + id);
     if (curModule != null && curModule.nextModule != id)
     {
         Debug.Log("Request to begin guide module " + id + " but a guide is running ID: " + curModule.ID);
         return(false);
     }
     if (!debug)
     {
         if (MainPlayer.Instance.IsGuideCompleted(id))
         {
             Debug.Log("Request to begin guide module " + id + " but this guide is completed.");
             return(false);
         }
         GuideModule module = GameSystem.Instance.GuideConfig.GetModule(id);
         if (module == null)
         {
             Debug.LogError("Guide module " + id + " not found.");
         }
         //if (module.skipConditions.Count > 0)
         //{
         //	if (ConditionValidator.Instance.Validate(module.skipConditions, module.skipConditionParams))
         //	{
         //		isDebugging = debug;
         //		SendBeginGuideReq(id, debug);
         //		return false;	//This guide will be skipped, continue on next guide.
         //	}
         //}
         if (!ConditionValidator.Instance.Validate(module.conditionTypes, module.conditionParams))
         {
             return(false);
         }
     }
     isDebugging = debug;
     SendBeginGuideReq(id, debug);
     return(true);
 }
Beispiel #19
0
    void BeginGuide(uint moduleID, bool debug = false)
    {
        GuideModule module    = GameSystem.Instance.GuideConfig.GetModule(moduleID);
        bool        isRestart = (MainPlayer.Instance.GetUncompletedGuide() == moduleID);

        if (isRestart && module.restartStep == 0)
        {
            ReqEndGuide(moduleID);
            return;
        }
        if (!isRestart && !IsUIVisible(module.uiName))          // UI visible is not required by restarted guide module
        {
            Debug.Log("Begin guide, UI not visible, ID: " + module.ID + " UI: " + module.uiName);
            return;
        }
        if (!debug)
        {
            if (module.skipConditions.Count > 0)                //directly skip
            {
                if (ConditionValidator.Instance.Validate(module.skipConditions, module.skipConditionParams, true))
                {
                    Debug.Log("Skip guide: " + module.ID);
                    ReqEndGuide(module.ID);
                    return;
                }
            }
            if (!ConditionValidator.Instance.Validate(module.conditionTypes, module.conditionParams))
            {
                return;
            }
        }
        curModule = module;
        uint firstStep = isRestart ? module.restartStep : module.firstStep;

        readyStep = GameSystem.Instance.GuideConfig.GetStep(firstStep);
    }
Beispiel #20
0
    //界面打开
    protected override void OnOpen(object param = null)
    {
        EventDelegate.Add(OkBtn.onClick, OnClickClose);

        PlayerDataModule pdm           = ModuleManager.Instance.FindModule <PlayerDataModule>();
        QuestAwardData   mCurAwardInfo = PlayerDataPool.Instance.MainData.mQuestData.GetAward();
        QuestTableItem   qti           = DataManager.QuestTable[mCurAwardInfo.mQuestId] as QuestTableItem;

        QuestName.text = qti.questName;
        ObjectCommon.DestoryChildren(DropGrid.gameObject);
        if (mAwardUIList != null)
        {
            mAwardUIList.Clear();
        }
        else
        {
            mAwardUIList = new List <AwardItemUI>();
        }

        for (int i = 0; i < mCurAwardInfo.mAwardList.Count; i++)
        {
            AwardItemUI temp = new AwardItemUI(mCurAwardInfo.mAwardList[i].mResId,
                                               (int)mCurAwardInfo.mAwardList[i].mNum);
            temp.gameObject.transform.parent     = DropGrid.gameObject.transform;
            temp.gameObject.transform.localScale = Vector3.one;
        }

        DropGrid.repositionNow = true;

        mCurStep = UIStep.STEP_ORIGINAL;

        //强制隐藏引导
        GuideModule module = ModuleManager.Instance.FindModule <GuideModule>();

        module.ForceHideGuide(true);
    }
Beispiel #21
0
    void ReadModule()
    {
        string text = ResourceLoadManager.Instance.GetConfigText(name1);

        if (text == null)
        {
            ErrorDisplay.Instance.HandleLog("LoadConfig failed: " + name1, "", LogType.Error);
            return;
        }

        XmlDocument doc  = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_GUIDE_MODULE, text);
        XmlNode     root = doc.SelectSingleNode("Data");

        foreach (XmlNode line in root.SelectNodes("Line"))
        {
            if (CommonFunction.IsCommented(line))
            {
                continue;
            }
            GuideModule module = new GuideModule();
            module.ID     = uint.Parse(line.SelectSingleNode("id").InnerText);
            module.uiName = line.SelectSingleNode("ui_name").InnerText;
            string types = line.SelectSingleNode("type").InnerText;
            if (!string.IsNullOrEmpty(types))
            {
                string[] tokens = types.Split('&');
                foreach (string token in tokens)
                {
                    module.conditionTypes.Add((ConditionType)int.Parse(token));
                }
            }
            string param = line.SelectSingleNode("param").InnerText;
            if (!string.IsNullOrEmpty(param))
            {
                module.conditionParams.AddRange(param.Split('&'));
            }
            if (module.conditionTypes.Count != module.conditionParams.Count)
            {
                ErrorDisplay.Instance.HandleLog("Guide module config error, wrong param num. ID: " + module.ID, "", LogType.Error);
            }
            module.firstStep = uint.Parse(line.SelectSingleNode("first_step").InnerText);
            uint.TryParse(line.SelectSingleNode("end_step").InnerText, out module.endStep);
            uint.TryParse(line.SelectSingleNode("restart_step").InnerText, out module.restartStep);
            string linkID = line.SelectSingleNode("link_id").InnerText;
            if (!string.IsNullOrEmpty(linkID))
            {
                string[] tokens = linkID.Split(',');
                module.linkID = tokens[0];
                if (tokens.Length > 1)
                {
                    uint.TryParse(tokens[1], out module.linkSubID);
                }
            }
            uint.TryParse(line.SelectSingleNode("next_module").InnerText, out module.nextModule);
            modules.Add(module.ID, module);
            List <GuideModule> list;
            if (!uiGuideMap.TryGetValue(module.uiName, out list))
            {
                list = new List <GuideModule>();
                uiGuideMap.Add(module.uiName, list);
            }
            types = line.SelectSingleNode("skip_condition").InnerText;
            if (!string.IsNullOrEmpty(types))
            {
                string[] tokens = types.Split('&');
                foreach (string token in tokens)
                {
                    module.skipConditions.Add((ConditionType)int.Parse(token));
                }
            }
            param = line.SelectSingleNode("skip_param").InnerText;
            if (!string.IsNullOrEmpty(param))
            {
                module.skipConditionParams.AddRange(param.Split('&'));
            }
            if (module.skipConditions.Count != module.skipConditionParams.Count)
            {
                ErrorDisplay.Instance.HandleLog("Guide module config error, wrong skip param num. ID: " + module.ID, "", LogType.Error);
            }
            list.Add(module);
        }
    }