private void onLeave(DodEvent eSource)
    {
        DE_LeaveMapNode e         = (DE_LeaveMapNode)eSource;
        string          pointKey  = e.point.toKey();                      //坐标键
        Profile         profile   = e.publisher.GetComponent <Profile>(); //获取Profile组件
        int             symb      = profile.getSymbol();                  //目标symbol
        ActorType       actorType = profile.actorType;                    //目标类型

        if (!_actors.ContainsKey(pointKey))                               //若还未存有坐标键,则新增 坐标-Actor集合 的键值对
        {
            _initPoint(e.point);
        }

        if (_actors[pointKey].ContainsKey(symb))         //若此Actor已存在于此坐标,则将其移除
        {
            _actors[pointKey].Remove(symb);
            if (actorType == ActorType.MONSTER)              //将此Actor依照种类从对应的表中移除
            {
                _enemies[pointKey].Remove(symb);
                // Debug.Log("remove");
            }
            else if (actorType == ActorType.OPERATOR)
            {
                _operators[pointKey].Remove(symb);
            }
        }
        else            //若此Actor还未存在于此坐标,则报告无效离开错误
        {
            Debug.Log(pointKey);
            Debug.LogWarning("Invalid Node Leaving");
        }
    }
    private void onEnter(DodEvent eSource)
    {
        DE_EnterMapNode e         = (DE_EnterMapNode)eSource;
        string          pointKey  = e.point.toKey();                      //坐标键
        Profile         profile   = e.publisher.GetComponent <Profile>(); //获取Profile组件
        int             symb      = profile.getSymbol();                  //目标symbol
        ActorType       actorType = profile.actorType;                    //目标类型

        if (!_actors.ContainsKey(pointKey))                               //若还未存有坐标键,则新增 坐标-Actor集合 的键值对
        {
            _initPoint(e.point);
        }

        if (!_actors[pointKey].ContainsKey(symb))         //若此Actor此前并未存在于此坐标,则将其加入此坐标
        {
            _actors[pointKey].Add(symb, e.publisher);
            if (actorType == ActorType.OPERATOR)              //将此Actor依照种类存入对应的表中
            {
                _operators[pointKey].Add(symb, e.publisher);
            }
            else if (actorType == ActorType.MONSTER)
            {
                _enemies[pointKey].Add(symb, e.publisher);
            }
        }
        else            //若此Actor已经存在于此坐标,则报告重复进入错误
        {
            Debug.LogWarning("Entering Map Node Twice");
        }
    }
Example #3
0
    public void Invoke(DodEvent e)
    {
        EType type = e.GetEType();

        if (dic.ContainsKey(type))
        {
            dic[type].Invoke(e);
        }
    }
Example #4
0
    private void addOperatorToMainUI(DodEvent eSource)
    {
        RM_AddOperatorToMainUI e   = (RM_AddOperatorToMainUI)eSource;
        GameObject             tmp = GameObject.Instantiate(Resources.Load <GameObject>("RenderRes/Image"));

        imagesReady.AddLast(tmp);
        tmp.GetComponent <UIimage>().loadNameToImage(e.name);
        tmp.GetComponent <UIimage>().clickAble = true;
        tmp.transform.SetParent(this.uiPanel.transform, false);
        tmp.transform.localPosition = new Vector2(-50 - (imagesReady.Count - 1) * 110, 87.5f);
        loadImage(tmp, e.name);
    }
Example #5
0
    private void pathListener(DodEvent source)
    {
        RM_ActorLocation e      = (RM_ActorLocation)source;
        Vector2          tmpvec = e.location;
        float            x      = tmpvec.x;
        float            y      = tmpvec.y;


        float xDown = Mathf.Floor(x);
        float xUp   = Mathf.Ceil(x);
        float yDown = Mathf.Floor(y);
        float yUp   = Mathf.Ceil(y);

        if (xUp > length - 1 || yUp > height - 1 || xDown < 0 || yDown < 0)
        {
            return;
        }
        Vector2 location1 = new Vector2(xDown, yDown);
        Vector2 location2 = new Vector2(xDown, yUp);
        Vector2 location3 = new Vector2(xUp, yDown);
        Vector2 location4 = new Vector2(xUp, yUp);
        bool    sample1   = mapPath[(int)location1.x, (int)location1.y];
        bool    sample2   = mapPath[(int)location2.x, (int)location2.y];
        bool    sample3   = mapPath[(int)location3.x, (int)location3.y];
        bool    sample4   = mapPath[(int)location4.x, (int)location4.y];

        if (sample1 == true)
        {
            sample1 = false;
            mapBlocks[(int)location1.x, (int)location1.y].GetComponent <MeshRenderer>().material = this.red;
        }
        if (sample2 == true)
        {
            sample2 = false;
            mapBlocks[(int)location2.x, (int)location2.y].GetComponent <MeshRenderer>().material = this.red;
        }
        if (sample3 == true)
        {
            sample1 = false;
            mapBlocks[(int)location3.x, (int)location3.y].GetComponent <MeshRenderer>().material = this.red;
        }
        if (sample4 == true)
        {
            sample1 = false;
            mapBlocks[(int)location4.x, (int)location4.y].GetComponent <MeshRenderer>().material = this.red;
        }
    }
    public void showImage(DodEvent source)
    {
        RM_ShowUIOperator e    = (RM_ShowUIOperator)source;
        string            name = e.name;

        // print(myName.Equals(name));
        if (!myName.Equals(name))
        {
            return;
        }

        if (this.imageDisabled == true)
        {
            this.imageDisabled = false;
            Performance_Center.Instance.ui.addToReadyList(image);
            // Performance_Center.Instance.ui.log();
        }
    }