示例#1
0
    private void Hide()
    {
        gameObject.SetActive(false);
        ViewGuideing = false;
        blackTrans.gameObject.SetActive(false);
        chartTrans.gameObject.SetActive(false);
        fingerTrans.gameObject.SetActive(false);
        trigTrans.gameObject.SetActive(false);
        if (targetTrans != null)
        {
            EventTriggerListener.Get(targetTrans.gameObject).onUp -= OnTargetUp;
        }
        EventTriggerListener.Get(blackTrans.gameObject).onClick = null;

        ClearTargetTrans(-1);
        ClearTargetTrans(0);
        ClearTargetTrans(1);

        targetParentTrans = null;
        configItem        = null;

        if (cycleActor != null)
        {
            cycleActor.OnDispose();
        }
    }
示例#2
0
    private void StartGuide(config_guide_item item)
    {
        //Debug.Log("StartGuide " + item.id);

        guidingItem = item;

        GuideView();
    }
示例#3
0
 public void ForceCompleteSave()
 {
     if (guidingItem != null)
     {
         if (!GuideInfo.completeRoots.Contains(guidingItem.root_id))
         {
             GuideInfo.completeRoots.Add(guidingItem.root_id);
             Save();
         }
     }
     guidingItem = null;
 }
示例#4
0
    private void ShowGuide()
    {
        ShowBase(10101, 99999);

        config_guide_item config_guide_item = (config_guide_item)CellWars_Editor.crt_item;

        config_guide_item.root_id      = (int)EditorGUILayout.Slider(CellWars_Editor.config_guide.template.root_id, config_guide_item.root_id, 10101, 99999);
        config_guide_item.next_id      = (int)EditorGUILayout.Slider(CellWars_Editor.config_guide.template.next_id, config_guide_item.next_id, 0, 99999);
        config_guide_item.condition    = EditorGUILayout.TextField(CellWars_Editor.config_guide.template.condition, config_guide_item.condition);
        config_guide_item.aims         = EditorGUILayout.TextField(CellWars_Editor.config_guide.template.aims, config_guide_item.aims);
        config_guide_item.complete_tip = EditorGUILayout.TextField(CellWars_Editor.config_guide.template.complete_tip, config_guide_item.complete_tip);
        config_guide_item.wait_time    = (int)EditorGUILayout.Slider(CellWars_Editor.config_guide.template.wait_time, config_guide_item.wait_time, -1, 5000);
        config_guide_item.Guide_type   = (int)EditorGUILayout.Slider(CellWars_Editor.config_guide.template.Guide_type, config_guide_item.Guide_type, 0, 10);
    }
示例#5
0
 private config_guide_item FindNextItem(config_guide_item item)
 {
     if (item == null)
     {
         return(null);
     }
     if (item.next_id == 0)
     {
         return(null);
     }
     else
     {
         config_guide_item nextItem = (config_guide_item)ResModel.Instance.config_guide.GetItem(item.next_id);
         return(nextItem);
     }
 }
示例#6
0
    private bool CheckRootComplete(config_guide_item item)
    {
        if (shield)
        {
            return(true);
        }

        for (int i = 0; i < GuideInfo.completeRoots.Count; i++)
        {
            if (GuideInfo.completeRoots[i] == item.root_id)
            {
                return(true);
            }
        }

        return(false);
    }
示例#7
0
    public void CheckGuide()
    {
        int startId = 0;

        if (shield)
        {
            return;
        }

        //Debug.Log("guidingItem == null " + (guidingItem == null));
        if (guidingItem == null)
        {
            if (GuideInfo.completeKeys.Count > 0)//todo 需要断线检查
            {
                int completeKey = GuideInfo.completeKeys[0];
                config_guide_item completeItem = (config_guide_item)ResModel.Instance.config_guide.GetItem(completeKey);
                //Debug.Log("out line continue");
                StartGuide(completeItem);
                return;
            }

            for (int i = 0; i < GuideRoots.Count; i++)
            {
                config_guide_item GuideRoot = GuideRoots[i];

                bool isComplete = CheckRootComplete(GuideRoot);

                if (GuideRoot.GetCompleteTemp() == false && isComplete == false && GuideRoot.id > startId)
                {
                    bool needGuide = ConditionCheck(GuideRoot);
                    if (needGuide)
                    {
                        //Debug.Log("find new Guide");
                        StartGuide(GuideRoot);
                        return;
                    }
                }
            }
            //Debug.Log("no needGuide");
        }
        else
        {
            GuideView();
        }
    }
示例#8
0
    public void InitGuide()
    {
        if (PlayerModel.CLEAR_ALL)
        {
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.GUIDE);
            guidingItem = null;
            shield      = true;
        }

        string GuideInfoStr = PlayerPrefsUtil.GetString(PlayerPrefsUtil.GUIDE);

        GuideInfo = JsonMapper.ToObject <GuideInfo>(GuideInfoStr);
        if (GuideInfo == null)
        {
            GuideInfo = new GuideInfo();
        }
        if (GuideInfo.completeRoots == null)
        {
            GuideInfo.completeRoots = new List <int>();
        }
        if (GuideInfo.completeKeys == null)
        {
            GuideInfo.completeKeys = new List <int>();
        }

        GuideRoots = new List <config_guide_item>();
        List <config_guide_item> configdata = ResModel.Instance.config_guide.data;

        for (int i = 0; i < configdata.Count; i++)
        {
            config_guide_item item = (config_guide_item)configdata[i];

            if (item.id == item.root_id)
            {
                GuideRoots.Add(item);
                if (PlayerModel.CLEAR_ALL)
                {
                    item.SetCompleteTemp(false);
                }
            }
        }

        //uiCamera = GameObject.Find("UICamera").GetComponent<Camera>();
    }
示例#9
0
    public void CompleteContinue()
    {
        guidingItem = FindNextItem(guidingItem);

        if (guidingItem == null)
        {
            CheckGuide();
        }
        else
        {
            if (guidingItem.wait_time > 0)
            {
                LeanTween.delayedCall(guidingItem.wait_time / 1000.00f, CheckGuide);
            }
            else
            {
                CheckGuide();
            }
        }
    }
示例#10
0
    public void CompleteSave()
    {
        config_guide_item nextItem = FindNextItem(guidingItem);

        if (nextItem == null)
        {
            if (!GuideInfo.completeRoots.Contains(guidingItem.root_id))
            {
                if (guidingItem.complete_tip != null && guidingItem.complete_tip != "")
                {
                    PromptModel.Instance.Pop(LanguageUtil.GetTxt(Convert.ToInt32(guidingItem.complete_tip)));
                }

                List <TIVInfo> conditions = guidingItem.GetConditions();
                if (conditions != null)
                {
                    for (int i = 0; i < conditions.Count; i++)
                    {
                        TIVInfo condition = conditions[i];

                        if (condition.id == (int)GuideIDType.play_map)
                        {
                            guidingItem.SetCompleteTemp(true);
                            return;
                        }
                    }
                }

                GuideInfo.completeRoots.Add(guidingItem.root_id);
                Save();
            }
        }
        else
        {
        }
    }
示例#11
0
    private bool ConditionCheck(config_guide_item item)
    {
        List <TIVInfo> conditions = item.GetConditions();

        bool isReach = true;

        for (int i = 0; i < conditions.Count; i++)
        {
            TIVInfo condition = conditions[i];
            switch ((int)condition.id)
            {
            case (int)GuideIDType.crt_star_num:

                int gameValue = MapModel.Instance.starInfo.crtStar;

                bool conditionCompare = ConditionCompare(condition, gameValue);

                if (conditionCompare == false)
                {
                    return(false);
                }

                break;

            case (int)GuideIDType.Guide_complete:

                if (GuideInfo.completeRoots.IndexOf((int)condition.value) == -1)
                {
                    return(false);
                }

                break;

            case (int)GuideIDType.pass_map:

                MapInfo map = MapModel.Instance.GetMapInfo((int)condition.value);

                if (map == null)
                {
                    return(false);
                }

                if (map.star <= 0)
                {
                    return(false);
                }
                break;

            case (int)GuideIDType.play_map:

                if (BattleModel.Instance.play_mapId != (int)condition.value)
                {
                    return(false);
                }

                break;

            case (int)GuideIDType.ready_map:

                if (BattleModel.Instance.ready_map != (int)condition.value)
                {
                    return(false);
                }

                break;

            case (int)GuideIDType.lose_map:

                if (BattleModel.Instance.lose_map != (int)condition.value)
                {
                    return(false);
                }

                break;
            }
        }
        return(isReach);
    }
示例#12
0
 private void OnUpdateViewEvent(config_guide_item item)
 {
     configItem = item;
     Show();
 }
示例#13
0
    public static void EditConfigItem(int id = 0)
    {
        if (id > 0)
        {
            crt_item = crt_config.GetItem(id);
        }
        else
        {
            switch (crt_config.name)
            {
            case CellWars_Editor.config_cell_name:
                crt_item = new config_cell_item();
                config_cell_item config_cell_item = (config_cell_item)crt_item;
                config_cell_item.Clear();
                config_cell_item.id      = config_cell.data[config_cell.GetDataCount() - 1].id + 1;
                config_cell_item.hide_id = config_cell_item.id;
                config_cell_item.icon    = config_cell_item.id;
                break;

            case CellWars_Editor.config_wall_name:
                crt_item = new config_wall_item();
                config_wall_item config_wall_item = (config_wall_item)crt_item;
                config_wall_item.Clear();
                config_wall_item.id = config_wall.data[config_wall.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_map_name:
                crt_item = new config_map_item();
                config_map_item config_map_item = (config_map_item)crt_item;
                config_map_item.Clear();
                config_map_item.id           = config_map.data[config_map.GetDataCount() - 1].id + 1;
                config_map_item.name         = "" + (config_map_item.id % 10000);
                config_map_item.icon         = config_map_item.id;
                config_map_item.step         = 20;
                config_map_item.pre_id       = (config_map_item.id - 1);
                config_map_item.task         = "10101|20,10102|21,10103|22,10104|23,10105|24";
                config_map_item.build        = 10000;
                config_map_item.fill         = 10000;
                config_map_item.judge        = "1000,2000,3000";
                config_map_item.forbid_skill = "10106,10112,10108,10114,10110";
                config_map_item.forbid_prop  = "";
                break;

            case CellWars_Editor.config_cover_name:
                crt_item = new config_cover_item();
                config_cover_item config_cover_item = (config_cover_item)crt_item;
                config_cover_item.Clear();
                config_cover_item.id = config_cover.data[config_cover.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_monster_name:
                crt_item = new config_monster_item();
                config_monster_item config_monster_item = (config_monster_item)crt_item;
                config_monster_item.Clear();
                config_monster_item.id = config_monster.data[config_monster.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_prop_name:
                crt_item = new config_prop_item();
                config_prop_item config_prop_item = (config_prop_item)crt_item;
                config_prop_item.Clear();
                config_prop_item.id = config_prop.data[config_prop.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_module_name:
                crt_item = new config_module_item();
                config_module_item config_module_item = (config_module_item)crt_item;
                config_module_item.Clear();
                config_module_item.id = config_module.data[config_module.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_guide_name:
                crt_item = new config_guide_item();
                config_guide_item config_guide_item = (config_guide_item)crt_item;
                config_guide_item.Clear();
                config_guide_item.id = config_guide.data[config_guide.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_chapter_name:
                crt_item = new config_chapter_item();
                config_chapter_item config_chapter_item = (config_chapter_item)crt_item;
                config_chapter_item.Clear();
                config_chapter_item.id = config_chapter.data[config_chapter.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_wealth_name:
                crt_item = new config_wealth_item();
                config_wealth_item config_wealth_item = (config_wealth_item)crt_item;
                config_wealth_item.Clear();
                config_wealth_item.id = config_wealth.data[config_wealth.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_skill_name:
                crt_item = new config_skill_item();
                config_skill_item config_skill_item = (config_skill_item)crt_item;
                config_skill_item.Clear();
                config_skill_item.id = config_skill.data[config_skill.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_sort_name:
                crt_item = new config_sort_item();
                config_sort_item config_sort_item = (config_sort_item)crt_item;
                config_sort_item.Clear();
                config_sort_item.id = config_sort.data[config_sort.GetDataCount() - 1].id + 1;
                break;
            }
        }
    }
示例#14
0
    public static void SaveCrtItem(bool isDelete = false)
    {
        if (crt_item != null)
        {
            switch (crt_config.name)
            {
            case CellWars_Editor.config_cell_name:
                config_cell_item config_cell_item = (config_cell_item)config_cell.GetItem(crt_item.id);
                if (config_cell_item == null)
                {
                    config_cell.data.Add((config_cell_item)crt_item);
                }
                break;

            case CellWars_Editor.config_wall_name:
                config_wall_item config_wall_item = (config_wall_item)config_wall.GetItem(crt_item.id);
                if (config_wall_item == null)
                {
                    config_wall.data.Add((config_wall_item)crt_item);
                }
                break;

            case CellWars_Editor.config_map_name:
                config_map_item config_map_item = (config_map_item)config_map.GetItem(crt_item.id);
                if (config_map_item == null)
                {
                    config_map.data.Add((config_map_item)crt_item);
                }

//				int cellCount = config_cell.data.Count;
//				int coverCount = config_cover.data.Count;
//				int monsterCount = config_monster.data.Count;
//				int allCount = cellCount + coverCount + monsterCount;
//
//				int dataCount = config_map.GetDataCount();
//				for (int i = 0; i < dataCount; i++)
//				{
//					config_map_item = (config_map_item)config_map.GetItemAt(i);
//					if(config_map_item.id > 20010)
//					{
//						config_map_item.special = "";
//						int randomIndex = Random.Range(0,allCount);
//						if(randomIndex < cellCount)
//						{
//							config_map_item.special = "cell_" + config_cell.GetItemAt(randomIndex).icon;
//						}else if(randomIndex < (cellCount + coverCount))
//						{
//							config_map_item.special = "cover_" + config_cover.GetItemAt(randomIndex - cellCount).icon;
//						}else
//						{
//							config_map_item.special = "monster_" + config_monster.GetItemAt(randomIndex - cellCount - coverCount).icon;
//						}
//					}
//				}

                break;

            case CellWars_Editor.config_cover_name:
                config_cover_item config_cover_item = (config_cover_item)config_cover.GetItem(crt_item.id);
                if (config_cover_item == null)
                {
                    config_cover.data.Add((config_cover_item)crt_item);
                }
                break;

            case CellWars_Editor.config_monster_name:
                config_monster_item config_monster_item = (config_monster_item)config_monster.GetItem(crt_item.id);
                if (config_monster_item == null)
                {
                    config_monster.data.Add((config_monster_item)crt_item);
                }
                break;

            case CellWars_Editor.config_prop_name:
                config_prop_item config_prop_item = (config_prop_item)config_prop.GetItem(crt_item.id);
                if (config_prop_item == null)
                {
                    config_prop.data.Add((config_prop_item)crt_item);
                }
                break;

            case CellWars_Editor.config_module_name:
                config_module_item config_module_item = (config_module_item)config_module.GetItem(crt_item.id);
                if (config_module_item == null)
                {
                    config_module.data.Add((config_module_item)crt_item);
                }
                break;

            case CellWars_Editor.config_guide_name:
                config_guide_item config_guide_item = (config_guide_item)config_guide.GetItem(crt_item.id);
                if (config_guide_item == null)
                {
                    config_guide.data.Add((config_guide_item)crt_item);
                }
                break;

            case CellWars_Editor.config_chapter_name:
                config_chapter_item config_chapter_item = (config_chapter_item)config_chapter.GetItem(crt_item.id);
                if (config_chapter_item == null)
                {
                    config_chapter.data.Add((config_chapter_item)crt_item);
                }
                break;

            case CellWars_Editor.config_wealth_name:
                config_wealth_item config_wealth_item = (config_wealth_item)config_wealth.GetItem(crt_item.id);
                if (config_wealth_item == null)
                {
                    config_wealth.data.Add((config_wealth_item)crt_item);
                }
                break;

            case CellWars_Editor.config_skill_name:
                config_skill_item config_skill_item = (config_skill_item)config_skill.GetItem(crt_item.id);
                if (config_skill_item == null)
                {
                    config_skill.data.Add((config_skill_item)crt_item);
                }
                break;

            case CellWars_Editor.config_sort_name:
                config_sort_item config_sort_item = (config_sort_item)config_sort.GetItem(crt_item.id);
                if (config_sort_item == null)
                {
                    config_sort.data.Add((config_sort_item)crt_item);
                }
                break;
            }
        }

        switch (crt_config.name)
        {
        case CellWars_Editor.config_cell_name:
            config_cell.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_cell), true);
            break;

        case CellWars_Editor.config_wall_name:
            config_wall.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_wall), true);
            break;

        case CellWars_Editor.config_map_name:
            config_map.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_map), true);
            break;

        case CellWars_Editor.config_cover_name:
            config_cover.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_cover), true);
            break;

        case CellWars_Editor.config_monster_name:
            config_monster.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_monster), true);
            break;

        case CellWars_Editor.config_prop_name:
            config_prop.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_prop), true);
            break;

        case CellWars_Editor.config_module_name:
            config_module.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_module), true);
            break;

        case CellWars_Editor.config_guide_name:
            config_guide.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_guide), true);
            break;

        case CellWars_Editor.config_chapter_name:
            config_chapter.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_chapter), true);
            break;

        case CellWars_Editor.config_wealth_name:
            config_wealth.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_wealth), true);
            break;

        case CellWars_Editor.config_skill_name:
            config_skill.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_skill), true);
            break;

        case CellWars_Editor.config_sort_name:
            config_sort.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_sort), true);
            break;
        }
    }