Ejemplo n.º 1
0
 public void ReceiveSprite(Sprite image)
 {
     //Debug.Log("PlanetController received Sprite");
     data.image = image;
     if (selectedPlanet == this)
     {
         PlanetDisplay.GetInstance().UpdateInfo(data.title, data.creator, data.description, data.year, data.des_tag, data.image);
     }
 }
    public void Awake()
    {
        display = GetComponentInParent <PlanetDisplay>();

        //button = GetComponentInChildren<Button>();
        //button.GetComponentInChildren<Text>().text = "Enter Planet";
        UnityAction action = new UnityAction(display.OnClick);

        button.onClick.AddListener(action);
        button.GetComponentInChildren <Text>().text = "Enter Planet";
    }
Ejemplo n.º 3
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this);
     }
     else
     {
         instance = this;
     }
 }
Ejemplo n.º 4
0
 public void spare()
 {
     sfx.buttonPress();
     cam.spared();
     if (cam.focus.gameObject.CompareTag("Asteroid"))
     {
         asteroidDisplay = cam.focus.GetComponent <AsteroidDisplay>();
         asteroidDisplay.a_button.onClick.Invoke();
     }
     else
     {
         focusDisplay = cam.focus.GetComponent <PlanetDisplay>();
         focusDisplay.p_button.onClick.Invoke();
     }
 }
Ejemplo n.º 5
0
 public static void DeselectPlanet()
 {
     if (selectedPlanet != null)
     {
         LeverScript lever = LeverScript.GetInstance();
         lever.SetThrottle(lever.GetDefaultThrottle());
         PlanetDisplay disp = PlanetDisplay.GetInstance();
         if (disp.GetViewTarget() == selectedPlanet.transform)
         {
             disp.SetVisible(false);
             disp.SetViewTarget(null);
             disp.GetTravelInteractable().SetExeString("");
         }
         selectedPlanet.Highlight("none");
         selectedPlanet = null;
     }
 }
Ejemplo n.º 6
0
    public void PointerClick()
    {
        if (selectedPlanet == this)
        {
            LeverScript lever = LeverScript.GetInstance();
            lever.SetThrottle(lever.GetDefaultThrottle());
            PlanetDisplay disp = PlanetDisplay.GetInstance();
            if (disp.GetViewTarget() == transform)
            {
                disp.SetVisible(false);
                disp.SetViewTarget(null);
                disp.GetTravelInteractable().SetExeString("");
            }

            selectedPlanet = null;

            Highlight("none"); // disables highlights
        }
        else
        {
            LeverScript.GetInstance().SetThrottle(0.0f);
            PlanetDisplay disp = PlanetDisplay.GetInstance();
            disp.SetVisible(true);
            disp.SetViewTarget(transform);
            disp.UpdateInfo(data.title, data.creator, data.description, data.year, data.des_tag, data.image);
            disp.GetTravelInteractable().SetExeString(ExecutableSwitch.GetFullPath(data.executable + ".exe", data.executable, data.year));

            if (selectedPlanet != null)
            {
                selectedPlanet.Highlight("none");
            }
            selectedPlanet = this;

            Highlight("selected");
        }
    }
Ejemplo n.º 7
0
    /*
     * Handles teleportation to a new year. Calls CreateYear and Destroys previous year
     *
     * TeleportToYear: Handles teleportation to a new year. Calls CreateYear and Destroys previous year
     * Parameters: int newYear - the year to travel to so as to create the year
     *             bool useAnimation - default is true. Won't use animation if going from a project back to a year
     */

    public IEnumerator TeleportToYear(int newYear, bool useAnimation = true)
    {
        CurrentlyTraveling = true;
        ImageLoader.GetInstance().CancelLoading();
        PlanetController.DeselectPlanet();

        //Check if there have been planets created before
        if (atYear != -1)
        {
            //Destroy planets in the previous year
            DestroyPlanets(atYear);
        }

        bool[] reenablePanels = new bool[panels.Length];

        //Start teleportation system traveling there by calling from Hyperspeed script
        if (useAnimation)
        {
            for (int index = 0; index < panels.Length; index++)
            {
                reenablePanels[index] = panels[index].enabled;
                panels[index].enabled = false;
            }
            yield return(StartCoroutine(HyperSpeedController.GetComponentInChildren <Hyperspeed>().Travel(true)));
        }

        PlanetDisplay disp = PlanetDisplay.GetInstance();

        if (disp != null)
        {
            disp.SetVisible(false);
            disp.SetViewTarget(null);
        }

        //Create the new year with planets
        CreateYear(newYear);

        //Change the color of the skybox by hashing the year
        Material skybox = RenderSettings.skybox;

        skybox.SetInt("_Rotation", 20 * newYear);
        int   currYearName       = int.Parse(list_years[newYear].yr_name);
        int   colorValueToChange = newYear % 3;
        Color newSkyboxColor;
        float newColorValue = (((float)currYearName * 42) % 255) / 255; //42 is arbitrary, but also... well, you've heard the joke by now

        if (colorValueToChange == 0)                                    // change red value
        {
            newSkyboxColor = new Color(newColorValue, origSkyboxColor.g, origSkyboxColor.b);
            skybox.SetColor("_Tint", newSkyboxColor);
        }
        else if (colorValueToChange == 1)           // change green value
        {
            newSkyboxColor = new Color(origSkyboxColor.r, newColorValue, origSkyboxColor.b);
            skybox.SetColor("_Tint", newSkyboxColor);
        }
        else if (colorValueToChange == 2)           //change blue value
        {
            newSkyboxColor = new Color(origSkyboxColor.r, origSkyboxColor.g, newColorValue);
            skybox.SetColor("_Tint", newSkyboxColor);
        }
        else
        {
            Debug.LogWarning("Invalid Skybox Year Index");
        }
        RenderSettings.skybox = skybox;

        atYear = newYear;
        YearSelectMain.GetInstance().SetPrimaryYear(Int32.Parse(list_years[atYear].yr_name));

        //Start teleportation system ending by Hyperspeed script call
        if (useAnimation)
        {
            for (int index = 0; index < panels.Length; index++)
            {
                panels[index].enabled = reenablePanels[index];
            }
            yield return(StartCoroutine(HyperSpeedController.GetComponentInChildren <Hyperspeed>().Travel(false)));
        }
        CurrentlyTraveling = false;
    }
        // 天体の表示
        private void planetRender(double startdegree,
                                  List <PlanetData> list1,
                                  List <PlanetData> list2,
                                  List <PlanetData> list3,
                                  List <PlanetData> list4,
                                  List <PlanetData> list5
                                  )
        {
            List <bool>          dispList     = new List <bool>();
            List <PlanetDisplay> pDisplayList = new List <PlanetDisplay>();

            if (tempSettings.bands == 1)
            {
                boxReset();
                list1.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }
                    if (planet.no == 10000)
                    {
                        return;
                    }
                    if (planet.no == 10001)
                    {
                        return;
                    }
                    if (currentSetting.dispPlanet[0][planet.no] == false)
                    {
                        return;
                    }

                    PointF point;
                    PointF pointdegree;
                    PointF pointsymbol;
                    PointF pointminute;
                    PointF pointretrograde;
                    // 重ならないようにずらしを入れる
                    // 1サインに6度単位5個までデータが入る
                    int absolute_position = getNewAbsPosition(planet);
                    int index             = boxSet(absolute_position);

                    if (ringCanvas.ActualWidth < 470)
                    {
                        point       = rotate(rcanvas.outerWidth / 3 - 20, 0, 5 * index - startdegree + 3);
                        pointdegree = rotate(rcanvas.outerWidth / 3 - 40, 0, 5 * index - startdegree + 3);
                    }
                    else
                    {
                        point       = rotate(rcanvas.outerWidth / 3 + 20, 0, 5 * index - startdegree + 3);
                        pointdegree = rotate(rcanvas.outerWidth / 3, 0, 5 * index - startdegree + 3);
                    }
                    pointsymbol     = rotate(rcanvas.outerWidth / 3 - 20, 0, 5 * index - startdegree + 3);
                    pointminute     = rotate(rcanvas.outerWidth / 3 - 40, 0, 5 * index - startdegree + 3);
                    pointretrograde = rotate(rcanvas.outerWidth / 3 - 60, 0, 5 * index - startdegree + 3);
                    point           = getNewPoint(point);

                    pointdegree.X     += (float)rcanvas.outerWidth / 2;
                    pointdegree.X     -= 8;
                    pointsymbol.X     += (float)rcanvas.outerWidth / 2;
                    pointsymbol.X     -= 8;
                    pointminute.X     += (float)rcanvas.outerWidth / 2;
                    pointminute.X     -= 8;
                    pointretrograde.X += (float)rcanvas.outerWidth / 2;
                    pointretrograde.X -= 8;

                    pointdegree.Y     *= -1;
                    pointdegree.Y     += (float)rcanvas.outerHeight / 2;
                    pointdegree.Y     -= 15;
                    pointsymbol.Y     *= -1;
                    pointsymbol.Y     += (float)rcanvas.outerHeight / 2;
                    pointsymbol.Y     -= 15;
                    pointminute.Y     *= -1;
                    pointminute.Y     += (float)rcanvas.outerHeight / 2;
                    pointminute.Y     -= 15;
                    pointretrograde.Y *= -1;
                    pointretrograde.Y += (float)rcanvas.outerHeight / 2;
                    pointretrograde.Y -= 15;

                    dispList.Add(planet.isDisp);
                    bool retrograde;
                    if (planet.speed < 0)
                    {
                        retrograde = true;
                    }
                    else
                    {
                        retrograde = false;
                    }

                    Explanation exp = new Explanation()
                    {
                        planet     = CommonData.getPlanetText(planet.no),
                        degree     = planet.absolute_position % 30,
                        sign       = CommonData.getSignTextJp(planet.absolute_position),
                        retrograde = retrograde,
                        planetNo   = planet.no
                    };

                    string degreeTxt;
                    if (mainWindow.config.decimalDisp == Config.EDecimalDisp.DECIMAL)
                    {
                        degreeTxt = ((planet.absolute_position) % 30 - 0.5).ToString("00");
                    }
                    else
                    {
                        degreeTxt = ((planet.absolute_position) % 30 - 0.5).ToString("00°");
                    }
                    string minuteTxt;
                    if (mainWindow.config.decimalDisp == Config.EDecimalDisp.DECIMAL)
                    {
                        minuteTxt = ((planet.absolute_position % 1 * 100) - 0.5).ToString("00");
                    }
                    else
                    {
                        minuteTxt = ((planet.absolute_position % 1) * 60 - 0.5).ToString("00") + "'";
                    }
                    PlanetDisplay display = new PlanetDisplay()
                    {
                        planetNo    = planet.no,
                        isDisp      = planet.isDisp,
                        explanation = exp,
                        planetPt    = point,
                        planetTxt   = CommonData.getPlanetSymbol(planet.no),
                        planetColor = CommonData.getPlanetColor(planet.no),
                        degreePt    = pointdegree,
                        degreeTxt   = degreeTxt,
                        symbolPt    = pointsymbol,
                        symbolTxt   = CommonData.getSignText(planet.absolute_position),
                        minutePt    = pointminute,
                        // 小数点以下切り捨て 59.9->59
                        minuteTxt     = minuteTxt,
                        retrogradePt  = pointretrograde,
                        retrogradeTxt = CommonData.getRetrograde(planet.speed),
                        symbolColor   = CommonData.getSignColor(planet.absolute_position)
                    };
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    if (ringCanvas.ActualWidth < 470 || tempSettings.centerPattern == 1)
                    {
                        SetOnlySignDegree(displayData);
                    }
                    else
                    {
                        SetSign(displayData);
                    }
                });
            }
            // 二重円
            else if (tempSettings.bands == 2)
            {
                boxReset();
                list1.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }
                    if (currentSetting.dispPlanet[0][planet.no] == false)
                    {
                        return;
                    }

                    PointF point;
                    int absolute_position = getNewAbsPosition(planet);
                    int index             = boxSet(absolute_position);

                    point = rotate(rcanvas.outerWidth / 5 + 20, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });
                boxReset();

                list2.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }
                    if (currentSetting.dispPlanet[1][planet.no] == false)
                    {
                        return;
                    }

                    PointF point;
                    int absolute_position = getNewAbsPosition(planet);
                    int index             = boxSet(absolute_position);

                    point = rotate(rcanvas.outerWidth / 3 + 20, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });
            }

            // 三重円
            else if (tempSettings.bands == 3)
            {
                boxReset();
                list1.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    if (currentSetting.dispPlanet[0][planet.no] == false)
                    {
                        return;
                    }

                    PointF point;
                    int absolute_position = getNewAbsPosition(planet);
                    int index             = boxSet(absolute_position);

                    point = rotate(rcanvas.outerWidth / 5, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                boxReset();

                list2.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    if (currentSetting.dispPlanet[1][planet.no] == false)
                    {
                        return;
                    }

                    if (planet.sensitive)
                    {
                        return;
                    }

                    PointF point;
                    int absolute_position = getNewAbsPosition(planet);
                    int index             = boxSet(absolute_position);

                    point = rotate(rcanvas.outerWidth / 4 + 20, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });

                boxReset();

                list3.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    if (currentSetting.dispPlanet[2][planet.no] == false)
                    {
                        return;
                    }

                    if (planet.sensitive)
                    {
                        return;
                    }


                    PointF point;
                    int absolute_position = getNewAbsPosition(planet);
                    int index             = boxSet(absolute_position);

                    point = rotate(rcanvas.outerWidth / 3 + 20, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });
            }

            // 四重円
            else if (tempSettings.bands == 4)
            {
                boxReset();
                list1.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 5, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp = getExp(planet);

                    PlanetDisplay display = new PlanetDisplay()
                    {
                        planetNo    = planet.no,
                        isDisp      = planet.isDisp,
                        explanation = exp,
                        planetPt    = point,
                        planetTxt   = CommonData.getPlanetSymbol(planet.no),
                        planetColor = CommonData.getPlanetColor(planet.no)
                    };
                    pDisplayList.Add(display);
                });

                boxReset();

                list2.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 4, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });

                boxReset();

                list3.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 3 - 5, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });

                boxReset();

                list4.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 3 + 20, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });
            }

            // 五重円
            else if (tempSettings.bands == 5)
            {
                boxReset();
                list1.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point    = rotate(rcanvas.outerWidth / 5, 0, 5 * index - startdegree);
                    point.X += (float)rcanvas.outerWidth / 2;
                    point.X -= 8;

                    point.Y *= -1;
                    point.Y += (float)rcanvas.outerHeight / 2;
                    point.Y -= 18;

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                boxReset();

                list2.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 4, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });

                boxReset();

                list3.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 4 + 20, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });

                boxReset();

                list4.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 3, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp       = getExp(planet);
                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });

                boxReset();

                list5.ForEach(planet =>
                {
                    // 天体表示させない
                    if (!planet.isDisp)
                    {
                        return;
                    }

                    PointF point;
                    int index = boxSet(planet.absolute_position);

                    point = rotate(rcanvas.outerWidth / 3 + 20, 0, 5 * index - startdegree);
                    point = getNewPoint(point);

                    dispList.Add(planet.isDisp);

                    Explanation exp = getExp(planet);

                    PlanetDisplay display = createPlanetDisplay(planet, exp, point);
                    pDisplayList.Add(display);
                });

                pDisplayList.ForEach(displayData =>
                {
                    if (!displayData.isDisp)
                    {
                        return;
                    }
                    SetOnlySign(displayData);
                });
            }
        }