コード例 #1
0
    //ÇØ´ç ºí·° Ä÷¯ ¸®¼Â
    public void CleanRestColor(Color_Node node, int change_color = 0)
    {
        Debug.Log("Ŭ¸®¾î ³ëµå üũ" + node.Index);
        Debug.Log("Ŭ¸®¾î ³ëµå ´ÙÀ½" + node.Next);

        if (node.Index != node.Next)
        {
            int next = node.Next;
            node.Next = node.Index;
            node      = this.GetNode(next);
            while (node.Index != node.Next || node.Index != node.Per)
            {
                next      = node.Next;
                node.Per  = node.Index;
                node.Next = node.Index;
                if (node.Type == G3BoardGenerator.Node_type.SEGMENT)
                {
                    node.Type  = G3BoardGenerator.Node_type.NONE;
                    node.Color = 0;
                }
                this.DoRemoveBlockHandle(node.Index);
                node = this.GetNode(next);
            }
        }
    }
コード例 #2
0
    public void CheckUpPos(Vector2 pos)
    {
        if (pos.x <= -400f || pos.x >= 400f || pos.y >= 400f || pos.y <= -400f)
        {
            return;
        }
        Vector2    expr_3C    = this.GetMousePosRowCol(pos);
        int        num        = (int)expr_3C.x;
        int        num2       = (int)expr_3C.y;
        Color_Node color_Node = this.Maps[num, num2];
        Color_Node headQueue  = this.GetHeadQueue(color_Node);

        if (color_Node.Type == G3BoardGenerator.Node_type.SEGMENT)
        {
            foreach (int current in this.GetAroundNode(color_Node.Index))
            {
                Color_Node node = this.GetNode(current);
                if (headQueue.Index != node.Index && node.Type == G3BoardGenerator.Node_type.TARGET && node.Color == color_Node.Color)
                {
                    color_Node.Next = node.Index;
                    node.Per        = color_Node.Index;
                    this.DoAddBlockHandle(node.Index);
                    if (this.mask_isInGuide != -1)
                    {
                        this.StartNoviceGuide(this.mask_isInGuide + 1);
                    }
                    this.DoRefreshHandle();
                    this.CheckIsVictory();
                    break;
                }
            }
        }
    }
コード例 #3
0
 public void PrintMaps()
 {
     for (int i = 0; i < this.m_map_row; i++)
     {
         string text = "";
         for (int j = 0; j < this.m_map_col; j++)
         {
             Color_Node color_Node = this.Maps[i, j];
             text = string.Concat(new object[]
             {
                 text,
                 "[i:",
                 color_Node.Index,
                 ",c:",
                 color_Node.Color,
                 "t:",
                 color_Node.Type,
                 ",n:",
                 color_Node.Next,
                 ",p:",
                 color_Node.Per,
                 "]  "
             });
         }
         MonoBehaviour.print(text);
     }
     UnityEngine.Debug.Log("------------------------");
 }
コード例 #4
0
 //ÇØ´ç ºí·° Á¤º¸ ¸®¼Â
 public void ResetNode(Color_Node node)
 {
     node.Next  = node.Index;
     node.Per   = node.Index;
     node.Color = 0;
     node.Type  = G3BoardGenerator.Node_type.NONE;
 }
コード例 #5
0
 private void RefreshMaps()
 {
     foreach (G3Line current in this.m_blocks)
     {
         Color_Node node = this.Model.GetNode(current.Index);
         this.ResetDirection(current, node);
     }
 }
コード例 #6
0
    public Color_Node GetHeadQueue(Color_Node node)
    {
        Color_Node color_Node = node;

        while (color_Node.Index != color_Node.Per)
        {
            color_Node = this.GetNode(color_Node.Per);
        }
        return(color_Node);
    }
コード例 #7
0
    public Color_Node GetEndQueue(Color_Node head)
    {
        Color_Node color_Node = head;

        while (color_Node.Index != color_Node.Next)
        {
            color_Node = this.GetNode(color_Node.Next);
        }
        return(color_Node);
    }
コード例 #8
0
 public void AddBlock(int index)
 {
     if (this.ExistInBlocks(index) == -1)
     {
         G3Line     g    = this.CreateBlock();
         Color_Node node = this.Model.GetNode(index);
         g.SetContentSize(new Vector2(this.Model.Cell_width, this.Model.Cell_height));
         g.Init(node.Index, node.Color, G3BoardGenerator.Node_type.SEGMENT);
         this.m_blocks.Add(g);
         AudioManager.GetInstance().PlayEffect("sound_eff_click_2");
     }
 }
コード例 #9
0
 //reload current map
 public void ReloadMaps()
 {
     Debug.Log("맵 세팅");
     this.LoadBoard();
     for (int i = 0; i < this.Model.m_map_row; i++)
     {
         for (int j = 0; j < this.Model.m_map_col; j++)
         {
             GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load("Prefabs/G00302") as GameObject);
             gameObject.transform.SetParent(this.gameBox.transform.Find("game_block"), false);
             gameObject.SetActive(true);
             Color_Node node = this.Model.GetNode(i, j);
             gameObject.GetComponent <G3Line>().SetContentSize(this.Model.Cell_width + (this.Model.Cell_width / 3), this.Model.Cell_height + (this.Model.Cell_height / 3));
             gameObject.GetComponent <G3Line>().Init(node.Index, node.Color, node.Type);
             this.m_maps.Add(gameObject.GetComponent <G3Line>());
         }
     }
 }
コード例 #10
0
    public bool CheckIsConnected(Color_Node node)
    {
        Color_Node color_Node;

        if (node.Next != node.Index)
        {
            color_Node = this.GetEndQueue(node);
        }
        else
        {
            if (node.Per == node.Index)
            {
                return(false);
            }
            color_Node = this.GetHeadQueue(node);
        }
        return(color_Node.Type == G3BoardGenerator.Node_type.TARGET && color_Node.Color == node.Color);
    }
コード例 #11
0
 public bool CheckIsVictory()
 {
     for (int i = 0; i < this.m_map_row; i++)
     {
         for (int j = 0; j < this.m_map_col; j++)
         {
             Color_Node node = this.GetNode(i, j);
             if (node.Type == G3BoardGenerator.Node_type.NONE)
             {
                 return(false);
             }
             if (node.Type == G3BoardGenerator.Node_type.TARGET && !this.CheckIsConnected(node))
             {
                 return(false);
             }
         }
     }
     UnityEngine.Debug.Log("Congratulations on your victory");
     base.GetComponent <G3BoardManager>().ShowVictory();
     return(true);
 }
コード例 #12
0
    public int CheckClickPos(Vector2 pos)
    {
        Debug.Log(pos);
        if (pos.x <= -400f || pos.x >= 400f || pos.y >= 400f || pos.y <= -400f)
        {
            return(-1);
        }
        Vector2    expr_3D    = this.GetMousePosRowCol(pos);
        int        num        = (int)expr_3D.x;
        int        num2       = (int)expr_3D.y;
        Color_Node color_Node = this.Maps[num, num2];

        if (this.mask_isInGuide != -1 && !this.HandelGuideClick(this.GetIndex(num, num2)))
        {
            return(-1);
        }
        if (color_Node != null)
        {
            switch (color_Node.Type)
            {
            case G3BoardGenerator.Node_type.NONE:
                return(-1);

            case G3BoardGenerator.Node_type.TARGET:
                this.CleanAllColor(color_Node.Color);
                break;

            case G3BoardGenerator.Node_type.SEGMENT:
                this.CleanRestColor(color_Node);
                break;

            default:
                return(-1);
            }
            return(color_Node.Index);
        }
        return(-1);
    }
コード例 #13
0
 public void ResetDirection(G3Line block, Color_Node node)
 {
     if (node.Per == node.Index - this.Model.m_map_col)
     {
         block.SetDirection(G3BoardGenerator.Direction.DOWN);
         return;
     }
     if (node.Per == node.Index + 1)
     {
         block.SetDirection(G3BoardGenerator.Direction.LEFT);
         return;
     }
     if (node.Per == node.Index + this.Model.m_map_col)
     {
         block.SetDirection(G3BoardGenerator.Direction.UP);
         return;
     }
     if (node.Per == node.Index - 1)
     {
         block.SetDirection(G3BoardGenerator.Direction.RIGHT);
         return;
     }
     block.SetDirection(G3BoardGenerator.Direction.NONE);
 }
コード例 #14
0
    //show victory dialog
    public void ShowVictory()
    {
        Debug.Log("게임 3 승리");
        this.m_isCanClick = false;
        AudioManager.GetInstance().PlayEffect("sound_eff_star_2");
        DOTween.Kill(this, false);
        Sequence sequence = DOTween.Sequence();

        for (int i = 0; i < this.Model.m_map_row; i++)
        {
            for (int j = 0; j < this.Model.m_map_col; j++)
            {
                Color_Node node = this.Model.GetNode(i, j);
                float      num  = (float)(i + j) / 10f;
                sequence.Insert(num, this.m_boards[node.Index].transform.DOScale(0.95f, 0.04f));
                sequence.Insert(num + 0.2f, this.m_boards[node.Index].transform.DOScale(1.05f, 0.04f));
                sequence.Insert(num + 0.4f, this.m_boards[node.Index].transform.DOScale(1f, 0.04f));
            }
        }
        sequence.AppendCallback(delegate
        {
            CloudOnceManager.Instance.Repart_LeaderBoard(Configs.TG00301[this.Model.Map_config.ID.ToString()].Level, 3);

            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load("Prefabs/G00303") as GameObject);
            gameObject.GetComponent <G3WinDialog>().Load(this.Model.Map_config.ID, this.Model.Map_config.Next, this.Model.Map_config.G003, this.Model.Map_config.Award, this.Model.Map_config.Target * 10);
            gameObject.GetComponent <G3WinDialog>().IsShowAward(GM.GetInstance().GetScoreRecord(3) + 1 <= this.Model.Map_config.ID);
            DialogManager.GetInstance().show(gameObject);

            GameObject eff_levelup = UnityEngine.Object.Instantiate <GameObject>(Resources.Load("Prefabs/effect/eff_levelup") as GameObject);
            //gameObject.transform.SetParent(base.transform, false);
            UnityEngine.Object.Destroy(eff_levelup, 5f);
            this.Model.SaveScore();
            this.Model.Mask_isVictory = true;
        });
        sequence.SetTarget(this);
    }
コード例 #15
0
 public int GetNeedTipsColor()
 {
     List <int[]>[] path = this.Path;
     for (int i = 0; i < path.Length; i++)
     {
         List <int[]> list = path[i];
         for (int j = 0; j < this.m_map_row; j++)
         {
             for (int k = 0; k < this.m_map_col; k++)
             {
                 Color_Node node = this.GetNode(j, k);
                 int        num  = 0;
                 foreach (int[] current in list)
                 {
                     if (node.Index == current[0])
                     {
                         if (node.Color != current[1])
                         {
                             int result = current[1];
                             return(result);
                         }
                     }
                     else
                     {
                         num++;
                     }
                 }
                 if (num >= list.Count && node.Color == list[0][1])
                 {
                     return(node.Color);
                 }
             }
         }
     }
     return(0);
 }
コード例 #16
0
    public void RefreshBoard()
    {
        for (int i = 0; i < this.Model.m_map_row; i++)
        {
            for (int j = 0; j < this.Model.m_map_col; j++)
            {
                Color_Node node = this.Model.GetNode(i, j);
                //if (node.Type == G3BoardGenerator.Node_type.TARGET)
                //{
                //	if (node.Next != node.Index || node.Per != node.Index)
                //	{
                //		this.m_boards[node.Index].SetColor(node.Color);
                //	}
                //	else
                //	{
                //		this.m_boards[node.Index].SetColor(0);
                //	}
                //}
                //else
                //{
                //	this.m_boards[node.Index].SetColor(node.Color);
                //}
            }
        }

        foreach (G3Line current in this.m_maps)
        {
            Color_Node node2 = this.Model.GetNode(current.Index);
            if (node2.Type == G3BoardGenerator.Node_type.TARGET)
            {
                if (this.Model.CheckIsConnected(node2))
                {
                    current.ShowStar();

                    foreach (G3Line current2 in this.m_blocks)
                    {
                        Color_Node node3 = this.Model.GetNode(current2.Index);
                        if (node3.Type == G3BoardGenerator.Node_type.SEGMENT)
                        {
                            if (node3.Color == node2.Color)
                            {
                                current2.img_block.color = new Color(1, 1, 1, 1);
                            }
                        }
                    }
                }
                else
                {
                    current.HideStar();

                    foreach (G3Line current2 in this.m_blocks)
                    {
                        Color_Node node3 = this.Model.GetNode(current2.Index);
                        if (node3.Type == G3BoardGenerator.Node_type.SEGMENT)
                        {
                            if (node3.Color == node2.Color)
                            {
                                current2.img_block.color = new Color(1, 1, 1, 0.5f);
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #17
0
    public int CheckDropPos(int click, Vector2 pos)
    {
        if (pos.x <= -400f || pos.x >= 400f || pos.y >= 400f || pos.y <= -400f)
        {
            return(-1);
        }

        bool       flag           = false;
        Vector2    mousePosRowCol = this.GetMousePosRowCol(pos);
        int        index          = this.GetIndex((int)mousePosRowCol.x, (int)mousePosRowCol.y);
        Color_Node headQueue      = this.GetHeadQueue(this.GetNode(click));
        Color_Node color_Node     = this.GetEndQueue(this.GetNode(click));

        if (color_Node.Index == index)
        {
            return(-1);
        }
        if (headQueue.Index != color_Node.Index && headQueue.Color == color_Node.Color && color_Node.Type == G3BoardGenerator.Node_type.TARGET)
        {
            return(-1);
        }
        if (this.mask_isInGuide != -1 && !this.HandelGuideClick(index))
        {
            return(-1);
        }
        List <int> pathNode = this.GetPathNode(color_Node.Index, index);

        if (pathNode.Count > 0 && this.GetNode(index).Type == G3BoardGenerator.Node_type.TARGET && color_Node.Color != this.GetNode(index).Color)
        {
            pathNode.RemoveAt(pathNode.Count - 1);
        }
        if (pathNode.Count > 0)
        {
            pathNode.RemoveAt(0);
        }

        Color_Node color_Node2 = null;

        foreach (int current in pathNode)
        {
            if (flag)
            {
                click = color_Node2.Index;
            }

            headQueue   = this.GetHeadQueue(this.GetNode(click));
            color_Node  = this.GetEndQueue(this.GetNode(click));
            color_Node2 = this.GetNode(current);

            //³ëµå üũ
            if (color_Node2 != null)
            {
                switch (color_Node2.Type)
                {
                case G3BoardGenerator.Node_type.NONE:
                    Debug.Log("¾øÀ»‹š");
                    color_Node.Next   = color_Node2.Index;
                    color_Node2.Per   = color_Node.Index;
                    color_Node2.Color = color_Node.Color;
                    color_Node2.Type  = G3BoardGenerator.Node_type.SEGMENT;
                    this.DoAddBlockHandle(color_Node2.Index);
                    break;

                case G3BoardGenerator.Node_type.TARGET:
                    if (color_Node.Color == color_Node2.Color && headQueue.Index != color_Node2.Index)
                    {
                        color_Node.Next = color_Node2.Index;
                        color_Node2.Per = color_Node.Index;
                        this.DoAddBlockHandle(color_Node2.Index);
                        if (this.mask_isInGuide != -1)
                        {
                            this.StartNoviceGuide(this.mask_isInGuide + 1);
                        }
                        this.CheckIsVictory();
                    }
                    break;

                case G3BoardGenerator.Node_type.SEGMENT:
                    //¹è±³ ³»²¨
                    Debug.Log("ÀÖÀ»¶§");
                    Debug.Log(color_Node2.Index + "   +   " + color_Node.Index);
                    Debug.Log(color_Node2.Color + "   +   " + color_Node.Color);

                    if (color_Node2.Color == color_Node.Color)
                    {
                        flag = true;
                        while (color_Node2.Index != color_Node.Index)
                        {
                            int per = color_Node.Per;
                            this.ResetNode(color_Node);
                            this.DoRemoveBlockHandle(color_Node.Index);
                            color_Node = this.GetNode(per);
                        }
                        color_Node2.Next = color_Node2.Index;
                    }
                    else
                    {
                        G3BoardManager.GetInstance().Change_Color(color_Node2.Index, color_Node.Color);
                        Color_Node expr_24E = this.GetNode(color_Node2.Per);
                        expr_24E.Next = expr_24E.Index;
                        this.CleanRestColor(color_Node2);
                        color_Node.Next   = color_Node2.Index;
                        color_Node2.Per   = color_Node.Index;
                        color_Node2.Color = color_Node.Color;
                    }
                    break;
                }
            }
        }
        this.DoRefreshHandle();
        this.mask_click = false;
        if (flag)
        {
            return(color_Node2.Index);
        }
        return(-1);
    }
コード例 #18
0
    public void GetPrompted()
    {
        if (!this.mask_tips_click)
        {
            this.InitTipsPath();
            this.mask_tips_click = true;
        }

        if (DataManager.Instance.state_Player.item_Localdata.Hint <= 0)
        {
            GameList.Instance.Shop_Return();
            return;
        }

        FireBaseManager.Instance.LogEvent("Puzzle_Mix_Magnigier");

        AudioManager.GetInstance().PlayEffect("sound_eff_item_tips");
        DataManager.Instance.state_Player.item_Localdata.Hint -= 1;
        DataManager.Instance.Save_Player_Data();

        GetComponent <G3BoardManager>().Set_Item_Txt();

        int needTipsColor = this.GetNeedTipsColor();

        if (needTipsColor == 0)
        {
            return;
        }
        this.CleanAllColor(needTipsColor);
        bool       flag       = true;
        Color_Node color_Node = null;

        foreach (int[] current in this.Path[needTipsColor - 1])
        {
            if (flag)
            {
                color_Node = this.GetNode(current[0]);
                flag       = false;
            }
            else
            {
                Color_Node node = this.GetNode(current[0]);
                switch (node.Type)
                {
                case G3BoardGenerator.Node_type.NONE:
                    color_Node.Next = node.Index;
                    node.Per        = color_Node.Index;
                    node.Color      = color_Node.Color;
                    node.Type       = G3BoardGenerator.Node_type.SEGMENT;
                    this.DoAddBlockHandle(node.Index);
                    break;

                case G3BoardGenerator.Node_type.TARGET:
                    color_Node.Next = node.Index;
                    node.Per        = color_Node.Index;
                    this.DoAddBlockHandle(node.Index);
                    if (this.mask_isInGuide != -1)
                    {
                        this.StartNoviceGuide(this.mask_isInGuide + 1);
                    }
                    this.CheckIsVictory();
                    break;

                case G3BoardGenerator.Node_type.SEGMENT:
                {
                    Color_Node expr_FF = this.GetNode(node.Per);
                    expr_FF.Next = expr_FF.Index;
                    this.CleanRestColor(node);
                    color_Node.Next = node.Index;
                    node.Per        = color_Node.Index;
                    node.Color      = color_Node.Color;
                    break;
                }
                }
                color_Node = node;
            }
        }
        this.DoRefreshHandle();
    }