public void UpdateSelection(int index) { if (index < 0 || index >= cellData.Count) { return; } scrollPositionController.ScrollTo(index, 0.4f); Context.SelectedIndex = index; UpdateContents(); }
void OnPressedCell(Example02ScrollViewCell cell) { //hhh var myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.persistentDataPath, "AssetBundles/armodel")); if (myLoadedAssetBundle == null) { Debug.Log("Failed to load AssetBundle!"); return; } all = myLoadedAssetBundle.LoadAllAssets <AnimationClip>(); GameObject Model = GameObject.Find("armodel(Clone)"); anim = Model.GetComponent <Animation>(); if (anim == null) { Debug.Log("anim is null"); Model.AddComponent <Animation>(); anim = Model.GetComponent <Animation>(); } myLoadedAssetBundle.Unload(false); invisible.gameObject.SetActive(true); showing_obj.gameObject.SetActive(true); temp_obj.gameObject.SetActive(false); scrollPositionController.ScrollTo(cell.DataIndex, 0.4f); Context.SelectedIndex = cell.DataIndex; if (anim == null) { Debug.Log("anim is null"); Model.AddComponent <Animation>(); anim = Model.GetComponent <Animation>(); } anim.Play(Context.SelectedIndex + "step"); GameObject stepText = GameObject.Find("Step"); Text nn = stepText.GetComponent <Text>(); nn.text = "Step " + (Context.SelectedIndex + 1); Debug.Log(all.Length); Debug.Log("Animation " + Context.SelectedIndex + " " + all[Context.SelectedIndex]); UpdateContents(); }
public void UpdateSelection(int index) { if (index < 0 || index >= CellData.Count || index == Context.SelectedIndex) { return; } Context.SelectedIndex = index; UpdateContents(); scrollPositionController.ScrollTo(index, 0.4f); onSelectedIndexChanged?.Invoke(index); }
void OnPressedCell(Example03ScrollViewCell cell) { scrollPositionController.ScrollTo(cell.DataIndex, 0.4f); Context.SelectedIndex = cell.DataIndex; UpdateContents(); }
void OnCellClicked(int index) { scrollPositionController.ScrollTo(index, 0.4f); Context.SelectedIndex = index; UpdateContents(); }
public void UpdateSelection(int selectedCellIndex) { scrollPositionController.ScrollTo(selectedCellIndex, scrollToDuration); context.SelectedIndex = selectedCellIndex; UpdateContents(); }