Beispiel #1
0
    private void OnInvitationReceived(Invitation invitation, bool shouldAutoAccept)
    {
        Debug.Log("Invitation recieved " + shouldAutoAccept + " " + invitation.Inviter.DisplayName);

        // We use it to automatically to invoke what we want to do or have the user decide
        UnityEngine.Events.UnityAction action = () => {
            ScaneManager.Instance.GoToSceneThenDo("GooglePlayConnectScreen", () => {
                GooglePlayGameManager manager = FindObjectOfType <GooglePlayGameManager>();

                PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, manager);
                manager.ShowRoomMakingPanel();
            });
        };

        if (shouldAutoAccept)
        {
            action.Invoke();
        }
        else
        {
            PopupManager.Instance.PopUp(
                new PopUpTwoButton(invitation.Inviter.DisplayName + "\nwould like to play with you!", "Decline", "Accept")
                .SetButtonColors(new Color(0.95686f, 0.26275f, 0.21176f), new Color(0.29804f, 0.68627f, 0.31373f))
                .SetButtonTextColors(Color.white, Color.white)
                .SetButtonPressActions(() => { }, action)
                );
        }
    }
Beispiel #2
0
 private static System.Collections.IEnumerator OnDelayCallEndOfFrame(UnityEngine.Events.UnityAction rFunc)
 {
     yield return(new WaitForEndOfFrame()); if (rFunc != null)
     {
         rFunc();
     }
 }
Beispiel #3
0
        private void Setup()
        {
            if (string.IsNullOrEmpty(PrivacyPolicy))
            {
                StartCoroutine(GET_FILE(SERVER_FILE.PP));
            }

            Accept.GetComponentInChildren <TextMeshProUGUI>().text  = "Continue";
            Decline.GetComponentInChildren <TextMeshProUGUI>().text = "Back";
            Decline.onClick.AddListener(delegate()
            {
                Setup();
                BackButton.GetComponent <Button>().onClick.Invoke();
            });

            MainContent.text = "\n\n\nThe YUR Mobile App requires the creation of a YUR account." +
                               "\n In order to do that, you will have to read, understand and agree to the following" +
                               "\n Privacy Policy, Terms of Service, and End User License Agreement." +
                               "\n" +
                               "\n" +
                               "Press Continue";

            Accept.interactable = true;
            unityAction         = new UnityEngine.Events.UnityAction(delegate()
            {
                Display_PrivacyPolicy();
            });

            Accept.onClick.AddListener(unityAction);

            Legal.SetActive(true);
            SignUp.SetActive(false);
        }
Beispiel #4
0
        protected void SaveFile(string path, byte[] datas, UnityEngine.Events.UnityAction onFailed = null)
        {
            var bundleName = System.IO.Path.GetFileName(path);
            var dir        = System.IO.Path.GetDirectoryName(path);

            try
            {
                if (!System.IO.Directory.Exists(dir))
                {
                    System.IO.Directory.CreateDirectory(dir);
                }

                System.IO.File.WriteAllBytes(path, datas);

                LoggerManager.Instance().LogProcessFormat("TrySave {0} To {1} Succeed ...", bundleName, path);
            }
            catch (System.Exception e)
            {
                LoggerManager.Instance().LogErrorFormat("TrySave {0} To {1} Failed ...", bundleName, path);
                LoggerManager.Instance().LogErrorFormat(e.ToString());
                if (null != onFailed)
                {
                    onFailed.Invoke();
                }
            }
        }
        private void Start()
        {
            HarmonyInstance harmony = HarmonyInstance.Create("tacview.harmony");

            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            api = VTOLAPI.instance;


            System.IO.Directory.CreateDirectory("TacViewDataLogs");

            support.WriteLog($"TacView Data Logger {Globals.projectVersion} Loaded. Waiting for Scene Start!");

            SceneManager.sceneLoaded += SceneLoaded;
            SceneReloaded            += RestartScenarioDetected;


            support.WriteLog($"VR Device Refresh Rate: {UnityEngine.XR.XRDevice.refreshRate.ToString()}");
            support.WriteLog($"Target frame time: {(1 / UnityEngine.XR.XRDevice.refreshRate).ToString()}");

            minFrameTime = (1 / UnityEngine.XR.XRDevice.refreshRate) + .0005f;
            maxFrameTime = (1 / UnityEngine.XR.XRDevice.refreshRate) + .001f;
            support.WriteLog($"Min: { minFrameTime} Max: {maxFrameTime}");

            frameRateLogSize = (int)UnityEngine.XR.XRDevice.refreshRate * 2;
            frameRateLog     = new FixedSizedQueue <float>(frameRateLogSize);
        }
Beispiel #6
0
 public void RemoveButtonListener(UnityEngine.Events.UnityAction func)
 {
     if (this.gameObject.GetComponent <Button> () != null)
     {
         this.gameObject.GetComponent <Button>().onClick.RemoveListener(func);
     }
 }
        public override void Initialize()
        {
            ChangeState(generalState);
            PlayAnimation(generalState.idle[0]);

            currentModularAnimationCallbacks = new UnityEngine.Events.UnityAction[1];
        }
Beispiel #8
0
 private static System.Collections.IEnumerator OnDelayCall(float time, UnityEngine.Events.UnityAction rFunc)
 {
     yield return(new WaitForSeconds(time)); if (rFunc != null)
     {
         rFunc();
     }
 }
 static public UnityEngine.Events.UnityAction EventDelegate(LuaFunction func)
 {
     UnityEngine.Events.UnityAction d = () =>
     {
         func.Call();
     };
     return(d);
 }
 public override void AppendCompleteCallback(UnityEngine.Events.UnityAction action)
 {
     if (null == action)
     {
         return;
     }
     OnDOTweenComplete.RemoveListener(action);
     OnDOTweenComplete.AddListener(action);
 }
Beispiel #11
0
        /// <summary>
        /// ボタンをクリックした際に呼ばれるリスナーを削除する
        /// </summary>
        /// <param name="tOnClick">リスナーメソッド</param>
        public void RemoveOnClickListener(UnityEngine.Events.UnityAction tOnClick)
        {
            Button tButton = _button;

            if (tButton != null)
            {
                tButton.onClick.RemoveListener(tOnClick);
            }
        }
Beispiel #12
0
    public Timer(float time, UnityEngine.Events.UnityAction callback)
    {
        this.maxTime = time;
        this.time    = time;

        if (!(callback is null))
        {
            timedEvent.AddListener(callback);
        }
    }
Beispiel #13
0
 public void Display_EndUserLicenseAgreement()
 {
     scrollbar.value = 1;
     Accept.onClick.RemoveListener(unityAction);
     MainContent.text = "In order to continue, you must read and accept our End User License Agreement. \n\n" + EndUserLicenseAgreement;
     unityAction      = new UnityAction(delegate()
     {
         PresentSignUpScreen();
     });
     Accept.onClick.AddListener(unityAction);
 }
Beispiel #14
0
 public void Display_TermsofService()
 {
     scrollbar.value = 1;
     Accept.onClick.RemoveListener(unityAction);
     MainContent.text = "In order to continue, you must read and accept our Terms of Service. \n\n" + TermsOfService;
     unityAction      = new UnityAction(delegate()
     {
         Display_EndUserLicenseAgreement();
     });
     Accept.onClick.AddListener(unityAction);
 }
Beispiel #15
0
        public void Show(string text, UnityEngine.Events.UnityAction callback)
        {
            m_Text.text = text;

            gameObject.SetActive(true);

            m_ButtonCallback = callback;
            if (m_ButtonCallback != null)
            {
                m_ButtonComponent.onClick.RemoveListener(m_ButtonCallback);
            }
            m_ButtonComponent.onClick.AddListener(m_ButtonCallback);
        }
Beispiel #16
0
 public void ScreenWhiteToNormal(float duration, UnityEngine.Events.UnityAction action = null)
 {
     if (duration <= 0)
     {
         ScreenMask.Hide(); return;
     }
     ScreenMask.Show(false, false, duration);
     Utils.GameUtil.DelayFunc(delegate { if (action != null)
                                         {
                                             action();
                                         }
                                         ScreenMask.Hide(); }, duration);
 }
Beispiel #17
0
        public void Display_PrivacyPolicy()
        {
            scrollbar.value = 1;
            Accept.onClick.RemoveListener(unityAction);
            MainContent.text = "In order to continue, you must read and accept our Privacy Policy. \n\n" + PrivacyPolicy;
            Accept.GetComponentInChildren <TextMeshProUGUI>().text = "Accept";
            unityAction = new UnityAction(delegate()
            {
                Display_TermsofService();
            });
            Accept.onClick.AddListener(unityAction);

            Decline.GetComponentInChildren <TextMeshProUGUI>().text = "Decline";
        }
Beispiel #18
0
            public void Invoke(string label, UnityEngine.Events.UnityAction customFunc)
            {
                if (customFunc == null)
                {
                    throw new System.ArgumentNullException();
                }

                collapsed = EditorGUILayout.Foldout(collapsed, label);

                if (collapsed)
                {
                    EditorGUI.indentLevel++;
                    customFunc.Invoke();
                    EditorGUI.indentLevel--;
                }
            }
Beispiel #19
0
    // Start is called before the first frame update
    void Awake()
    {
        Instance = this;
        UnityEngine.Events.UnityAction [] actions = new UnityEngine.Events.UnityAction[2];
        actions[0] = () => { SwitchStatsAndActions(true); };
        actions[1] = () => { SwitchStatsAndActions(false); };
        actionsStatsButton.InitActions(actions, 0);
        actions[0].Invoke();

        myPanel.AddActionToButton(new UnityAction(() =>
        {
            if (GameManager.Instance.representationManager.currentRepresentation == GameManager.Instance.representationManager.buildingsRepresentation)
            {
                (GameManager.Instance.representationManager.buildingsRepresentation as MapRepresentation).DeselectAll();
            }
        }));
    }
Beispiel #20
0
 public void ScreenNormalToWhite(float duration, bool autoDisable, UnityEngine.Events.UnityAction action = null)
 {
     if (duration <= 0)
     {
         ScreenMask.ShowWhite(); return;
     }
     ScreenMask.Show(true, false, duration);
     Utils.GameUtil.DelayFunc(delegate { if (action != null)
                                         {
                                             action();
                                         }
                                         if (autoDisable)
                                         {
                                             ScreenMask.Hide();
                                         }
                              }, duration);
 }
Beispiel #21
0
        void Awake()
        {
            _transform = transform;
            _slider    = GetComponent <SliderJoint2D>();

            _arm_joint  = GetComponent <GymanJoint>();
            _hand_joint = HandU.GetComponent <GymanJoint>();
            _grab       = HandU.GetComponent <als_grab>();

            _lfinger = FingerL.GetComponent <HingeJoint2D>();
            _rfinger = FingerR.GetComponent <HingeJoint2D>();

            _update_action = new UnityEngine.Events.UnityAction[] {
                update__wait_stretch,
                update__wait_fold
            };
        }
    public override void AppendCompleteCallback(UnityEngine.Events.UnityAction action)
    {
        IDOTweenUtil tween = null;

        for (int i = AsyncTweenWidgets.Length - 1; i >= 0; i--)
        {
            tween = AsyncTweenWidgets[i];
            if (null == tween)
            {
                continue;
            }

            tween.AppendCompleteCallback(action);
            break;
        }

//		if(tween == null) _appendCallback = action;
    }
Beispiel #23
0
 public static int AddListener_wrap(long L)
 {
     try
     {
         long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Events.UnityEvent  obj   = get_obj(nThisPtr);
         UnityAction_delegate           func0 = FCDelegateMng.Instance.GetDelegate <UnityAction_delegate>(L, 0);
         UnityEngine.Events.UnityAction arg0  = null;
         if (func0 != null)
         {
             arg0 = func0.CallFunc;
         }
         // 尽量不要在函数参数中传递委托指针,这个无法自动托管,要尽可能是使用get, set属性方法
         // 如果在参数中传递了委托指针,请在对应的函数中调用FCDelegateMng.Instance.RecordDelegate(delegate_func, func);
         obj.AddListener(arg0);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
Beispiel #24
0
    static int UnregisterDirtyMaterialCallback(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        Graphic obj = (Graphic)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Graphic");

        UnityEngine.Events.UnityAction arg0 = null;
        LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

        if (funcType2 != LuaTypes.LUA_TFUNCTION)
        {
            arg0 = (UnityEngine.Events.UnityAction)LuaScriptMgr.GetNetObject(L, 2, typeof(UnityEngine.Events.UnityAction));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 2);
            arg0 = () =>
            {
                func.Call();
            };
        }

        obj.UnregisterDirtyMaterialCallback(arg0);
        return(0);
    }
Beispiel #25
0
    public IEnumerator RollDice(int dice1Value, int dice2Value, int playerNumber, UnityEngine.Events.UnityAction afterDiceRoll = null)
    {
        int   yStart     = 315;
        float correction = 90 * (playerNumber - 1);

        dices.transform.rotation = Quaternion.Euler(new Vector3(0, yStart - correction, 0));

        Animator dice1Animator = dice1.GetComponentInChildren <Animator>();

        dice1.SetActive(true);
        dice1Animator.SetInteger("RollNumber", dice1Value);

        Animator dice2Animator = dice2.GetComponentInChildren <Animator>();

        dice2.SetActive(true);
        dice2Animator.SetInteger("RollNumber", dice2Value);

        yield return(new WaitForSeconds(0.4f * (dice1Value + dice2Value) + 1.0f));

        dice1.SetActive(false);
        dice2.SetActive(false);

        afterDiceRoll?.Invoke();
    }
Beispiel #26
0
 protected override void Awake()
 {
     base.Awake();
     namesArray  = new string[] { "Carrot God", "Katana", "Philosophy" };
     methodArray = new UnityEngine.Events.UnityAction[] { delegate { CarrotGod(); }, delegate { Katana(); }, delegate { Philosophy(); } };
     costVariablesList.Add(carrotCostArray);
     costVariablesList.Add(katanaCostArray);
     costVariablesList.Add(philosophyCostArray);
     rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
         { StatsType.NotSetYet, carrotRewardArray }
     });
     rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
         { StatsType.NotSetYet, katanaRewardArray }
     });
     rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
         { StatsType.Attack, philosophyRewardArray }
     });
     messageArray = new string[]
     {
         "",
         "",
         "-Increases the Attack Damage of your Psychological Units"
     };
 }
Beispiel #27
0
    public static void ShowExplanationScreenV2(TextAsset textFile, UnityEngine.Events.UnityAction func)
    {
        RectTransform rt = explanationText.GetComponent <RectTransform>();

        string[] lines = textFile.ToString().Split('\n');

        // The first line is the title
        explanationText.text = "\n<b>" + lines[0] + "</b>\n\n";

        //Filling the rest of the info
        for (int i = 1; i < lines.Length; i++)
        {
            explanationText.text += lines[i] + "\n";
        }

        //Change size of text box to hold the text
        //Debug.Log(rt.rect.width);

        rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, explanationText.preferredHeight);

        explanationScreen.enabled = true;

        explanationScreen.GetComponentInChildren <Button>().onClick.AddListener(func);
    }
    static int set_onBeforeRender(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Application.set_onBeforeRender");
#endif
        try
        {
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.onBeforeRender' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"));
            }

            if (arg0.op == EventOp.Add)
            {
                UnityEngine.Events.UnityAction ev = (UnityEngine.Events.UnityAction)arg0.func;
                UnityEngine.Application.onBeforeRender += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                UnityEngine.Events.UnityAction ev = (UnityEngine.Events.UnityAction)arg0.func;
                UnityEngine.Application.onBeforeRender -= ev;
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #29
0
    public void showPopUp(string title,
                          string[] buttonTitles,
                          Action[] actionWhenButtonHit = null,
                          bool[] closePopUpWhenHit     = null)
    {
        if (isCurrentlyOpen)
        {
            saveParameters(title,
                           buttonTitles,
                           actionWhenButtonHit,
                           closePopUpWhenHit);
            return;
        }

        int i;

        if (closePopUpWhenHit == null)
        {
            closePopUpWhenHit = new bool[buttonTitles.Length];
            for (i = 0; i < closePopUpWhenHit.Length; i++)
            {
                closePopUpWhenHit[i] = true;
            }
        }

        if (actionWhenButtonHit == null)
        {
            actionWhenButtonHit = new Action[buttonTitles.Length];
            for (i = 0; i < actionWhenButtonHit.Length; i++)
            {
                actionWhenButtonHit[i] = () => { };
            }
        }

        UnityEngine.Assertions.Assert.IsFalse(
            buttonTitles.Length == 0,
            "No button titles provided");
        UnityEngine.Assertions.Assert.IsFalse(
            buttonTitles.Length != actionWhenButtonHit.Length,
            "Button and action array length must be the same");

        resetButtons();

        popUpTitle.GetComponent <Text>().text = title;

        for (i = 0; i < buttonTitles.Length; i++)
        {
            popUpButtons[i].SetActive(true);
            popUpButtons[i].GetComponentInChildren <Text>().text = buttonTitles[i];
            UnityEngine.Events.UnityAction action = new UnityEngine.Events.UnityAction(actionWhenButtonHit[i]);
            if (closePopUpWhenHit[i])
            {
                popUpButtons[i].GetComponent <Button>().onClick.AddListener(closePopUp);
            }

            popUpButtons[i].GetComponent <Button>().onClick.AddListener(action);
        }
        while (i < popUpButtons.Length)
        {
            popUpButtons[i].SetActive(false);
            i++;
        }
        popUpPanel.SetActive(true);
        isCurrentlyOpen = true;
    }
Beispiel #30
0
 public void ShowMessageBox(string TextContent, string TitleText, UnityEngine.Events.UnityAction YesEventFunc, UnityEngine.Events.UnityAction NoEventFunc)
 {
     transform.Find("Content").Find("Text").GetComponent <Text>().text = TextContent;
     transform.Find("Title").Find("Text").GetComponent <Text>().text   = TitleText;
     transform.Find("YesButton").GetComponent <Button>().onClick.AddListener(YesEventFunc);
     transform.Find("NoButton").GetComponent <Button>().onClick.AddListener(NoEventFunc);
     transform.Find("Title").Find("Button").GetComponent <Button>().onClick.AddListener(NoEventFunc);
     transform.gameObject.SetActive(true);
 }