示例#1
0
 /// <summary>
 /// OnGUI is called for rendering and handling GUI events.
 /// This function can be called multiple times per frame (one call per event).
 /// </summary>
 public void OnSceneGUI()
 {
     happyCheckStep = target as HappyCheckStep;
     Handles.color  = Color.white;
     if (mainData == null)
     {
         mainData = GameObject.Find("MainData").GetComponent <MainData>();
     }
     if (happyCheckStep.ufaMap == null)
     {
         return;
     }
     if (happyCheckStep.sortIndex < happyCheckStep.ufaIndexes.Length)
     {
         HCArea ufa = happyCheckStep.GetUfa(happyCheckStep.sortIndex);
         Handles.color = Color.yellow;
         Handles.Button(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap);
     }
     foreach (var index in happyCheckStep.stack)
     {
         HCArea ufa = happyCheckStep.GetUfa(index);
         Handles.color = happyCheckStep.numberCount == 0 ? Color.green : Color.red;
         Handles.Button(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap);
     }
     for (int i = 0; i < happyCheckStep.ufaIndexes.Length; i++)
     {
         if (happyCheckStep.ufaMap[happyCheckStep.GetUfa(i).pos] == 1)
         {
             HCArea ufa = happyCheckStep.GetUfa(i);
             Handles.color = Color.grey;
             Handles.Button(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.ArrowHandleCap);
         }
     }
 }
示例#2
0
 void OnSceneGUI()
 {
     if (showCas == null)
     {
         showCas = target as ShowCa;
     }
     if (mainData == null)
     {
         mainData = Singleton.MainData;
     }
     if (showCas.ca != null)
     {
         if (now == null)
         {
             Handles.color = Color.yellow;
             foreach (Area area in showCas.ca.numbers)
             {
                 if (Handles.Button(mainData.AreaPosWorld(area.pos), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap))
                 {
                     now      = area;
                     areaType = 0;
                 }
             }
             Handles.color = Color.red;
             foreach (Area area in showCas.ca.outsides)
             {
                 if (Handles.Button(mainData.AreaPosWorld(area.pos), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap))
                 {
                     now      = area;
                     areaType = 1;
                 }
             }
         }
         else
         {
             Color[] colors = { Color.yellow, Color.red };
             Handles.color = colors[1 - areaType];
             foreach (var neighbour in now.neighbours)
             {
                 if (Handles.Button(mainData.AreaPosWorld(neighbour.pos), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap))
                 {
                     now      = neighbour;
                     areaType = 1 - areaType;
                 }
             }
             Handles.color = colors[areaType];
             if (Handles.Button(mainData.AreaPosWorld(now.pos), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap))
             {
                 now = null;
             }
         }
     }
 }
示例#3
0
    /// <summary>
    /// OnGUI is called for rendering and handling GUI events.
    /// This function can be called multiple times per frame (one call per event).
    /// </summary>
    public void OnSceneGUI()
    {
        HappyCheck happyCheck = target as HappyCheck;

        Handles.color = Color.white;
        if (mainData == null)
        {
            mainData = GameObject.Find("MainData").GetComponent <MainData>();
        }
        if (happyCheck.map == null)
        {
            return;
        }
        if (now == null)
        {
            SmartList <HCArea>[] hack = { happyCheck.unFlipAreaList, happyCheck.numberList };
            for (int i = 0; i < 2; i++)
            {
                foreach (HCArea ufa in hack[i])
                {
                    Handles.color = ufa.value >= 0 ? Color.yellow : Color.red;
                    if (Handles.Button(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap))
                    {
                        now = ufa;
                    }
                    Handles.Label(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), ufa.value.ToString());
                }
            }
        }
        else
        {
            foreach (HCArea neighbor in now.neighbours)
            {
                Handles.color = neighbor.value >= 0 ? Color.yellow : Color.red;
                Handles.Label(mainData.AreaPosWorld(neighbor.pos.x, neighbor.pos.y), neighbor.value.ToString());
                if (Handles.Button(mainData.AreaPosWorld(neighbor.pos.x, neighbor.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap))
                {
                    now = neighbor;
                }
            }
            Handles.color = now.value >= 0 ? Color.yellow : Color.red;
            if (Handles.Button(mainData.AreaPosWorld(now.pos.x, now.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap))
            {
                now = null;
            }
        }
    }
示例#4
0
    /// <summary>
    /// OnGUI is called for rendering and handling GUI events.
    /// This function can be called multiple times per frame (one call per event).
    /// </summary>
    public virtual void OnSceneGUI()
    {
        Handles.color = Color.white;
        List2D <int> list2D = GetMainList2D();

        if (mainData == null)
        {
            mainData = GameObject.Find("MainData").GetComponent <MainData>();
        }
        if (list2D != null && list2D.XSize >= mainData.mineDatas.XSize && list2D.YSize >= mainData.mineDatas.YSize)
        {
            for (int i = 0; i < mainData.XSize; i++)
            {
                for (int j = 0; j < mainData.YSize; j++)
                {
                    Handles.Label(mainData.AreaPosWorld(i, j), list2D[i, j].ToString());
                }
            }
        }
    }
示例#5
0
    /// <summary>
    /// OnGUI is called for rendering and handling GUI events.
    /// This function can be called multiple times per frame (one call per event).
    /// </summary>
    public void OnSceneGUI()
    {
        MainData mainData = (target as MainDataMB).mainData;

        Handles.color = Color.white;
        for (int i = 0; i < mainData.XSize; i++)
        {
            for (int j = 0; j < mainData.YSize; j++)
            {
                int mineData = mainData.GetMineData(i, j);
                Handles.color = mineData == -1 ? Color.red : Color.white;
                if (Handles.Button(mainData.AreaPosWorld(i, j), Quaternion.identity, 0.5f, 0.5f, Handles.RectangleHandleCap))
                {
                    mainData.ReverseMineData(i, j);
                }
            }
        }
        foreach (var pos in mainData.mineDatas.Positions())
        {
            SingletonForEditor.DrawABeaultifulLabel(pos, mainData.mineDatas[pos].ToString());
        }
    }