Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        _bagUI = Resources.Load <GameObject>("Prefab/BagUI");
        Money  = transform.Find("/ToolsKit/Canvas/PlayerInfo/glodBoard/Text").GetComponent <Text>();
        Mine   = transform.Find("/ToolsKit/Canvas/PlayerInfo/mineBoard/Text").GetComponent <Text>();

        //获取事件控制器
        eventmanager = transform.Find("/ToolsKit/EventManager").GetComponent <ChatEventManager>();
        questManager = transform.Find("/ToolsKit/QuestManager").GetComponent <QuestManager>();

        UpdateShopGoodsData();
        InitShopGoods();
        UpdateShopMoney();

        EventTriggerListener.Get(GameObject.Find("Canvas/Button (2)")).onClick = OpenSpecialItemBag;
        EventTriggerListener.Get(GameObject.Find("Canvas/Button (3)")).onClick = OpenSpecialItemBagAll;
        EventTriggerListener.Get(GameObject.Find("Canvas/Button (4)")).onClick = PlayerInfo.ClearCompleteEvents;

        //增加进入地图次数
        PlayerInfo.AddSenceInfo(0);

        bool ishit = false;

        ishit = eventmanager.CheckUnCompleteEvent() || ishit;
        ishit = eventmanager.CheckEventList(ChatEventManager.ChatEvent.EventTypeList.InShop, false) || ishit;
        ishit = eventmanager.CheckEventList(ChatEventManager.ChatEvent.EventTypeList.SellGoods, false) || ishit;
        if (ishit)
        {
            eventmanager.StartStory();
        }
        else
        {
            eventmanager.PreCheckEventList(0);
            questManager.PreCheckQuest(0);
            questManager.IsArriveWaitingCheckPoint(0);
        }
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        //获取路径配置表
        GetPathConfig();
        state = MoveState.Stay;
        playerPoints.Nowpoint = startpoint;

        //获取价格文本,确定和取消按钮
        priceText       = priceBoard.Find("price/pricetext").GetComponent <Text>();
        btn_priceOK     = priceBoard.Find("ok").GetComponent <RectTransform>();
        btn_priceCancle = priceBoard.Find("cancle").GetComponent <RectTransform>();
        btn_okMask      = priceBoard.Find("okMask").GetComponent <RectTransform>();
        //获取采集文本和采集按钮
        MineText     = mineActionBoard.Find("Text").GetComponent <Text>();
        btn_mine     = mineActionBoard.Find("mine").GetComponent <RectTransform>();
        btn_mineMask = mineActionBoard.Find("mineMask").GetComponent <RectTransform>();
        //获取回家文版
        homeText = homeBoard.Find("Text").GetComponent <Text>();

        //读取角色配置表
        charaModle = GameObject.Find("/CollectionTools/CharacterModle").GetComponent <CharacterModle>();
        //获取地图的ui
        _mapUI = GameObject.Find("/CollectionTools/Colection").GetComponent <MapUI>();
        //读取采集控制脚本
        collectAction = GameObject.Find("/CollectionTools/Colection").GetComponent <CollectAction>();
        //获取事件控制器
        eventmanager = transform.Find("/ToolsKit/EventManager").GetComponent <ChatEventManager>();
        questManager = transform.Find("/ToolsKit/QuestManager").GetComponent <QuestManager>();

        InstPlayer(playerPoints.Nowpoint);
        AddPathPointListener();

        eventmanager.PreCheckEventList(1);
        questManager.PreCheckQuest(1);

        questManager.IsArriveWaitingCheckPoint(1);
    }
Beispiel #3
0
 void CheckEvent()
 {
     eventmanager.PreCheckEventList(0);
     questManager.PreCheckQuest(0);
     questManager.IsArriveWaitingCheckPoint(0);
 }
Beispiel #4
0
    void MovePath()
    {
        //如果有采集、回家图标,则关闭采集,回家图标
        CloseMineIcon();
        CloseHomeIcon();

        string root     = "/Canvas/Scroll View/Viewport/Content/map/pathList/";
        string pathline = "";

        Transform[] _ts = new Transform[0];

        //如果到达终点则打断
        if (playerPoints.Nowpoint == playerPoints.Targetpoint)
        {
            //增加路点次数信息
            PlayerInfo.AddMapInfo(playerPoints.Nowpoint);
            PlayerInfo.SetNowscene(playerPoints.Nowpoint);

            //检测触发事件
            if (eventmanager.CheckEventList(ChatEventManager.ChatEvent.EventTypeList.Arrive, true))
            {
                eventmanager.StartStory();
            }
            else
            {
                questManager.CheckQuestListWithArrive(playerPoints.Targetpoint);
                questManager.IsArriveWaitingCheckPoint(playerPoints.Targetpoint);
                eventmanager.PreCheckEventList(1);
                questManager.PreCheckQuest(1);
            }

            state = MoveState.Stay;
            AniController.Get(MovePlayer).PlayAniBySkin("down", AniController.AniType.LoopBack, 5);

            //关闭路点提示
            ClosePathPoint();
            CloseMovePathLine();
            movePathLine.Clear();

            if (playerPoints.Targetpoint != 1)
            {
                //显示采集图标
                ShowMineIcon(playerPoints.Targetpoint);
                return;
            }
            else
            {
                ShowHomeBoard(1);
                return;
            }
        }

        //找到移动的路径
        for (int i = 0; i <= Bestpaths.Count - 2; i++)
        {
            //根据方向排序
            if ((int)Bestpaths[i] == playerPoints.Nowpoint)
            {
                if ((int)Bestpaths[i + 1] > (int)Bestpaths[i])
                {
                    pathline = "pathLine_" + Bestpaths[i].ToString() + "_" + Bestpaths[i + 1].ToString();
                    Transform t = transform.Find(root + pathline);
                    if (t != null)
                    {
                        _ts = new Transform[t.childCount];
                        for (int j = 0; j < t.childCount; j++)
                        {
                            _ts[j] = t.GetChild(j);
                        }
                    }
                    else
                    {
                        Debug.Log("can't find pathline:" + root + pathline);
                    }
                }
                else
                {
                    pathline = "pathLine_" + Bestpaths[i + 1].ToString() + "_" + Bestpaths[i].ToString();
                    Transform t = transform.Find(root + pathline);
                    if (t != null)
                    {
                        _ts = new Transform[t.childCount];
                        for (int j = 0; j < t.childCount; j++)
                        {
                            _ts[j] = t.GetChild(t.childCount - 1 - j);
                        }
                    }
                    else
                    {
                        Debug.Log("can't find pathline:" + root + pathline);
                    }
                }
                playerPoints.Nextpoint = (int)Bestpaths[i + 1];
                break;
            }
        }

        //移动方法
        if (_ts.Length != 0)
        {
            playerPoints.Nowpoint = playerPoints.Nextpoint;
            Transform _map = transform.Find("/Canvas/Scroll View/Viewport/Content/map");
            Vector3[] vecs = new Vector3[_ts.Length + 2];

            for (int i = 0; i < _ts.Length; i++)
            {
                //vecs[i + 1] = _ts[i].position - _map.position;
                vecs[i + 1] = _ts[i].position;
            }
            vecs[0] = vecs[1];
            vecs[vecs.Length - 1] = vecs[vecs.Length - 2];

            state = MoveState.Moving;
            LTSpline cr   = new LTSpline(vecs);
            float    time = cr.distance / 5;
            LeanTween.move(MovePlayer.gameObject, cr, time).setOnComplete(() =>
            {
                playerPoints.Nowpoint = playerPoints.Nextpoint;
                MovePath();
            });

            SetCharacterVecter(vecs);
        }
    }
Beispiel #5
0
    //通过进入地图的id筛选出道具,然后通过权重选出拾取的东西。
    //如果以后会有专门进入地图的设定的话,则可以吧判断地图id筛选道具列表的方法单独移出。
    public void CollectionAction(int ap, RectTransform rect)
    {
        Debug.Log("mine:" + ap);

        //筛选出可以掉落的道具
        int       mapid = ap;
        ArrayList List  = new ArrayList();

        int max = 0;

        foreach (CollectionMap materiral in CollectionList)
        {
            if (materiral.Map == mapid)
            {
                List.Add(materiral);
                //获取随机范围
                max += materiral.Weight;
            }
        }

        //随机权重,选出拾取哪个道具
        CharBag.Goods dropMa = new CharBag.Goods();
        dropMa.Property = new int[4];

        int point = Random.Range(1, max);
        int check = 0;

        foreach (CollectionMap materiral in List)
        {
            check += materiral.Weight;

            if (check >= point)
            {
                //指定掉落的材料
                dropMa.MateriralType = materiral.MateriralType;

                dropMa.ID = materiral.ID;
                //指定数量,后期会修改为需要指定数量
                dropMa.Number = 1;

                //随机品质
                dropMa.Quality = Random.Range(materiral.RandomQuality[0], materiral.RandomQuality[1]);

                //随机属性;随机4个属性
                int random_max = 0;
                int propcount  = 0;
                for (int i = 0; i < materiral.RandomProperty.Length / 2; i++)
                {
                    random_max += materiral.RandomProperty[i, 1];
                }

                for (int index = 0; index < 4; index++)
                {
                    if (materiral.PropertyProbability < Random.Range(1, 100))
                    {
                        continue;
                    }

                    int _point = Random.Range(1, random_max);
                    int _check = 0;
                    //指定随机属性
                    for (int i = 0; i < materiral.RandomProperty.Length / 2; i++)
                    {
                        _check += materiral.RandomProperty[i, 1];
                        if (_check >= _point)
                        {
                            dropMa.Property[propcount] = materiral.RandomProperty[i, 0];
                            propcount++;
                            break;
                        }
                    }
                }
                break;
            } //endif
        }     //endforech

        //获取名称
        if (dropMa.MateriralType == 0)
        {
            Materiral.Items dorp_item = Materiral.FindItemByID(dropMa.ID);
            dropMa.Name = dorp_item.Name;
            //设定基础价格,之后还需要计算
            dropMa.Price = dorp_item.Price;

            //获取type
            dropMa.Type = Materiral.GetTypeByMaterialID(dropMa.MateriralType, dropMa.ID);
        }   //item
        else if (dropMa.MateriralType == 1)
        {
            Materiral.Minds drop_mind = Materiral.FindMindByID(dropMa.ID);
            dropMa.Name = drop_mind.Name;
            //设定基础价格,之后还需要计算
            dropMa.Price = drop_mind.Price;

            //获取type
            dropMa.Type = Materiral.GetTypeByMaterialID(dropMa.MateriralType, dropMa.ID);
        }   //mind

        //计算价格
        dropMa = CharBag.SetPrice(dropMa);
        //添加物品
        dropMa.UID = CharBag.AddGoods(dropMa);

        questManager.CheckQuestListWithGoods(QuestManager.QuestTypeList.CollectGoods, dropMa, ap);
        //更新物品信息
        PlayerInfo.AddGoodsInfo(dropMa.MateriralType, dropMa.ID, PlayerInfo.GoodsInfoType.CollectCount);
        eventmanager.PreCheckEventList(1);
        ShowMaterialIcon(dropMa, rect);
    }