예제 #1
0
    public void UpdateOnWarp()
    {
        if (ApplyOnce.alreadyApplied("Exit", gameObject))
        {
            return;
        }

        int beforeTop  = warpMenu.topMenu.menuIndex.Get();
        int beforeLeft = warpMenu.leftMenu.GetIndex();

        warpMenu.Update();
        if (beforeTop != warpMenu.topMenu.menuIndex.Get())
        {
            UpdateShrines();
        }
        if (beforeLeft != warpMenu.leftMenu.GetIndex())
        {
            if (currentImg)
            {
                currentImg.sprite = warpMenu.leftMenu.list[warpMenu.leftMenu.GetIndex()].shrineSprite;
            }
        }

        if (ButtonManager.GetDown(ButtonManager.ButtonID.CIRCLE, this))
        {
            ApplyOnce.apply("Exit", gameObject, () =>
            {
                if (currentImg)
                {
                    currentImg.sprite = null;
                }

                uiManager.ChangeMode(UIManager.Mode.NORMAL);
                uiManager.GetPlayer().ReceiveNotification(Asderek.Notification.Return);
                return(true);
            });
        }

        if (ButtonManager.GetDown(ButtonManager.ButtonID.X, this))
        {
            //if (currentImg)
            //    currentImg.sprite = null;
            ApplyOnce.apply("Exit", gameObject, () =>
            {
                foreach (KeyValuePair <Commandments.Shrines, ShrineInfo> element in shrineToTexture)
                {
                    if (element.Value.Equals(warpMenu.leftMenu.list[warpMenu.leftMenu.GetIndex()]))
                    {
                        loadManager.loadShrine(element.Key);
                        UIManager.GetInstance().ChangeMode(UIManager.Mode.NORMAL);
                        break;
                    }
                }
                return(true);
            }
                            );
        }
    }
예제 #2
0
 public void Update()
 {
     if (ApplyOnce.alreadyApplied("Interact", gameObject))
     {
         if (player.FinishedAnimation("sitting_neutral") || player.FinishedAnimation("seated"))
         {
             manager.SetWarp(displayImg);
             ApplyOnce.remove("Interact", gameObject);
         }
     }
 }
예제 #3
0
    public void verifyLoad()
    {
        if (startLoading)
        {
            if (playerScript.FinishedAnimation("sitting_neutral") || playerScript.FinishedAnimation("seated") || ApplyOnce.alreadyApplied("Reload", gameObject))
            {
                gameLoaded = false;
                //Interaction
                manager.ClearScreen();
                //string path = Application.dataPath + "/";
                string path = "D:/";
                string name = "temp.png";

                ApplyOnce.apply("ScreenShot", gameObject, () =>
                {
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    File.Delete(path + name);
                    ScreenCapture.CaptureScreenshot(path + name);
                    UpdateLoadPoints();
                    if (!ApplyOnce.alreadyApplied("Reload", gameObject))
                    {
                        Time.timeScale = 0;
                    }
                    return(true);
                });

                if (File.Exists(path + name))
                {
                    if (ApplyOnce.alreadyApplied("Reload", gameObject))
                    {
                        playerScript.ReceiveNotification(Asderek.Notification.Sit);
                    }


                    Texture2D auxImage = new Texture2D(100, 100);
                    auxImage.LoadImage(File.ReadAllBytes(path + name));
                    File.Delete(path + name);
                    colors = auxImage.GetPixels();

                    warpImage = new Texture2D(auxImage.width, auxImage.height);
                    warpImage.SetPixels(colors);
                    warpImage.Apply();


                    startLoading = false;
                    loadShrine();
                }
            }
        }
    }
예제 #4
0
    void Update()
    {
        verifyLoad();

        if (startTime < transitionTime)
        {
            if (ApplyOnce.alreadyApplied("Reload", gameObject))
            {
                UpdateCircleConstricting();
                UpdateHalo();
                startTime--;
                if (startTime < 0)
                {
                    startTime = 0;
                    ApplyOnce.remove("Reload", gameObject);
                }
                ApplyOnce.apply("ChangeMode", gameObject, () => {
                    UIManager.GetInstance().ChangeMode(UIManager.Mode.NORMAL);
                    return(true);
                });
            }
            else
            {
                if (startTime == 0)
                {
                    UpdateLoadPoints();
                }
                UpdateCircleSimplified();
                startTime++;
                UpdateHalo();
            }

            if (startTime >= transitionTime)
            {
                ApplyOnce.apply("notifyAsderek", gameObject, () =>
                {
                    playerScript.ReceiveNotification(Asderek.Notification.Return);
                    warpImage      = null;
                    Time.timeScale = manager.chosenTime;
                    gameLoaded     = true;
                    ApplyOnce.remove("ChangeMode", gameObject);
                    return(true);
                });
            }
        }
    }
예제 #5
0
 private void OnGUI()
 {
     if (startTime < transitionTime)
     {
         if (warpImage)
         {
             GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), warpImage);
             if (haloText != null && !ApplyOnce.alreadyApplied("Reload", gameObject))
             {
                 GUI.DrawTexture(haloRect, haloText);
             }
             else if (haloConstrictingText != null && ApplyOnce.alreadyApplied("Reload", gameObject))
             {
                 GUI.DrawTexture(haloRect, haloConstrictingText);
             }
         }
     }
 }
    public bool Update()
    {
        bool ret = false;

        if ((currentState == State.Pressed) && (lastDown >= longClick / 2))
        {
            currentState = State.Hold;
        }

        if (Get())
        {
            ApplyOnce.apply("pressed", this, () =>
            {
                lastDown     = 0;
                currentState = State.Pressed;
                ret          = true;
                return(true);
            });
        }
        else
        {
            if (ApplyOnce.alreadyApplied("pressed", this))
            {
                if (lastDown >= longClick)
                {
                    currentState = State.Long;
                }
                else
                {
                    currentState = State.Short;
                }
                ApplyOnce.remove("pressed", this);
            }
            else
            {
                currentState = State.None;
                requester    = null;
            }
        }

        lastDown++;
        return(ret);
    }
예제 #7
0
    private void SetActors()
    {
        foreach (KeyValuePair <Commandments.Shrines, GameObject> element in onScene)
        {
            //Debug.Log("Clearing shrine " + element.Key);
            Shrine shrine = element.Value.GetComponent <Shrine>();
            if (shrine)
            {
                shrine.Clear();
            }
        }

        Vector3 tempVect = onScene[destinyShrine].transform.position;

        tempVect.z = player.transform.position.z;
        player.transform.position = tempVect;
        playerScript.ResetLerp();
        playerScript.Reload();
        gameManager.getCurrentCamera().InstantChangeLocation(player);
        //msg = "New Player position: " + player.transform.position;

        if (warpImage)
        {
            if (ApplyOnce.alreadyApplied("Reload", gameObject))
            {
                startTime = transitionTime - 1;
            }
            else
            {
                //startTime = 0;
                //startTime = DEBUG_asd;
                for (startTime = 0; startTime < 2; startTime++)
                {
                    UpdateCircleSimplified();
                }
            }
        }

        ApplyOnce.remove("notifyAsderek", gameObject);
        ApplyOnce.remove("ScreenShot", gameObject);
    }
예제 #8
0
    public void ChangeLanguage(string name, bool force = false)
    {
        if ((languagues[currentLanguage.Get()].name == name) && (!force))
        {
            return;
        }

        for (int i = 0; i < languagues.Length; i++)
        {
            if (languagues[i].name == name)
            {
                currentLanguage.Set(i);
                yokaiDescriptionsJson.Load(languagues[i].yokaiJson);
                Beastiary beastiary = GetComponentInChildren <Beastiary>();
                foreach (YokaisJson.Description desc in yokaiDescriptionsJson.description)
                {
                    beastiary.yokais[desc.id].name        = desc.name;
                    beastiary.yokais[desc.id].description = desc.formatedText;
                }

                npcsJson.Load(languagues[i].npcJson);

                abilitiesJson.Load(languagues[i].abilityJson);

                menuJson.Load(languagues[i].menuJson);
                //print("Update menuJson Json Description: " + languagues[i].menuJson.name);
                //print("abilitiesJson: " + menuJson.mainMenu[0].name);

                for (int j = 0; j < menuJson.optionsMenu.Length; j++)
                {
                    for (int k = 0; k < menuJson.optionsMenu[j].items.Length; k++)
                    {
                        switch (menuJson.optionsMenu[j].items[k].type)
                        {
                        case MenuJson.OptionMenuTab.OptionsMenuItem.Type.Combo:
                            menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(menuJson.optionsMenu[j].items[k].combo.Length);
                            break;

                        case MenuJson.OptionMenuTab.OptionsMenuItem.Type.Special:
                            switch (menuJson.optionsMenu[j].items[k].special)
                            {
                            case MenuJson.OptionMenuTab.OptionsMenuItem.SpecialType.Language:
                                menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(languagues.Length);
                                break;

                            case MenuJson.OptionMenuTab.OptionsMenuItem.SpecialType.TitleFont:
                                menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(fonts.Length);
                                menuJson.optionsMenu[j].items[k].comboSelected.Set(saveJson.config.titleFontIndex);
                                break;

                            case MenuJson.OptionMenuTab.OptionsMenuItem.SpecialType.TextFont:
                                menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(fonts.Length);
                                menuJson.optionsMenu[j].items[k].comboSelected.Set(saveJson.config.textFontIndex);
                                break;
                            }
                            break;
                        }
                    }
                }


                if (ApplyOnce.alreadyApplied("StartGame", gameObject))
                {
                    UpdateLanguage();
                }

                break;
            }
        }
    }